Spaces:
Runtime error
Fix startup crash: ImportError (huggingface_hub-api-removed)
Hi! This Space currently fails to start on Hugging Face with:
ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/home/user/.pyenv/versions/3.10.18/lib/python3.10/site-packages/huggingface_hub/__init__.py)
Cause. diffusers 0.14 imports cached_download from huggingface_hub, which was removed in newer huggingface_hub releases (ImportError: cannot import name 'cached_download' from 'huggingface_hub'). The rebuild also pulled too-new starlette/fastapi/jinja2 for gradio 4.36.1, causing the UI TemplateResponse crash. Pinning the dependency era and making the pipeline device-aware fixes both issues.
Change. README.md, requirements.txt, src/synthesis.py. requirements.txt is a lockfile resolved as of 2024-07-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 an NVIDIA A10G (same GPU as a10g-small). The app started, and calling its /forward endpoint returned:
1 output file(s) (webp), non-empty
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.