How to install a specific version of gradio in Spaces?


The last version of gradio (2.7.0) comes with a display bug (launch this notebook diff_texts.ipynb from gradio at HighlightedText).

With the version 2.6.4 of gradio, there was no display bug:

However, when you create an App with gradio, Hugging Face Spaces says that the gradio package comes pre-installed at version 2.2.6. I think this text needs an update. (cc @sgugger)

More, I did try to create a new Spaces App with gradio. In the requirements.txt file, I added gradio==2.6.4 but it did not work.

How can I install the gradio version of my choice for a Spaces App? Thank you.

Note: see this issue on gradio github about the version 2.7.0 and HighlightedText.

Sorry about that! We’re fixing the bug but for now you can install a specific version of Gradio by adding lines like this at the top of your file:

import os
os.system("pip uninstall -y gradio")
os.system("pip install gradio==2.6.4")
1 Like