Spaces:
Runtime error
Runtime error
Fix: Update Gradio API for compatibility with Gradio 4.x+
#44
by
akseljoonas
HF Staff
- opened
Summary
This PR fixes the Space to work with modern Gradio versions (4.x and above).
Changes
app.py
gr.Image(source="upload")โgr.Image(sources=["upload"])- Thesourceparameter was renamed tosourcesand now accepts a listgr.Audio(source="upload")โgr.Audio(sources=["upload"])- Same change for Audio componentgr.Video(source="upload")โgr.Video(sources=["upload"])- Same change for Video component- Removed deprecated
api_openparameter fromdemo.queue()
requirements.txt
- Updated
gradioto a recent stable version - Updated
numpyto a compatible version (1.x series for compatibility with other deps) - Updated
torch,torchvision,torchaudioto more recent versions
Breaking Changes in Gradio 4.x+
The Gradio library underwent significant API changes in version 4.0:
- The
sourceparameter in media components was renamed tosourcesand changed from a string to a list - The
.style()method was removed from components - Queue parameters were simplified
Testing
These changes align with the current Gradio documentation and examples.