Spaces:
Runtime error
Fix startup crash: PIL.UnidentifiedImageError (gradio-api-drift)
Hi! This Space currently fails to start on Hugging Face with:
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fc9f81ba090>
Cause. The app ran but Spaces could not find callable events because gradio 2.9.4's config format is incompatible with today's platform; the previous runtime error was the missing User-Agent on the Wikimedia fetch. Migrating to gradio 4 components and bumping sdk_version resolves both.
Change. README.md, app.py. 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:
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.