Fix startup crash: AttributeError (gradio-api-drift)

#3
by kavyabhand - opened

Hi! This Space currently fails to start on Hugging Face with:

AttributeError: module 'gradio' has no attribute 'inputs'

Cause. The Space fails on current libraries for two reasons: app.py uses removed Gradio 3 APIs (gr.inputs.Image, gr.outputs.Textbox), causing AttributeError: module 'gradio' has no attribute 'inputs', and the rebuilt environment pairs Gradio 4.32.1 with a huggingface_hub version that no longer exports HfFolder, causing ImportError: cannot import name 'HfFolder'. Pinning the dependency era restores the Gradio 4-compatible huggingface_hub, while updating the two component calls restores the original image/text interface.

Change. README.md, app.py, requirements.txt. requirements.txt is a lockfile resolved as of 2024-06-15 (Python 3.10), so the app runs on the library versions it was written for. python_version is pinned in the README to the interpreter we tested with. Nothing else is touched.

Tested. We rebuilt the Space with this patch the way Spaces builds it (README front-matter, requirements.txt, then the SDK), on 2 vCPU / 16 GB, like cpu-basic. The app started, and calling its /predict endpoint returned:

'a dog running in the water with a frisbee '

The diagnosis and patch were written by Beam (Reflection AI's open model) as part of Space Doctor, a Build with Beam challenge project that repairs broken Spaces and only proposes fixes that pass this check. We read the diff before opening this PR. Feel free to close it if you'd rather fix it another way.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment