huggingface / evaluate

🤗 Evaluate: A library for easily evaluating machine learning models and datasets.
https://huggingface.co/docs/evaluate
Apache License 2.0
1.9k stars 235 forks source link

Gradio dependency issue #602

Open bnaman50 opened 4 weeks ago

bnaman50 commented 4 weeks ago

Context: I noticed this issue when I was working on submitting my own metric to the hub. At the top of the page, it keeps on asking me to update the Gradio version.

image

Error: Upon updating it, I got the following error - AttributeError: module 'gradio' has no attribute 'inputs'.

Reason: Upon further digging, I think the issue is occurs whenever you upgrade Gradio to version >=4.0. Turns out from version 4 onwards, gradio.inputs has been removed as you can see in the __init__ file. However, evaluate library calls it in launch_gradio_widget function in utils dir.

Solution: A simple solution would be to limit the dependency below Gradio version 4.0.0. This can be done by simply updating the line 63 in setup.py file. More specifically, instead of - "gradio>=3.0.0", it can be chnaged to "gradio>=3.0.0, <4.0.0" to fix the issue.

P.S. - I am still working on the metric so the page might go down until I fully complete it.

FahadEbrahim commented 1 week ago

Hi @bnaman50

Yes, I have the same issue.

I think that another solution would be to modify the code in src/evaluate/utils/gradio.py to change the syntax of the depreciated gr.inputs and gr.outputs to use the interface components directly. For maintaining current available evaluate metrics, the implementation can differ based on the version (an if statement would do).