AndrewRqy commited on
Commit ·
63f7ef4
1
Parent(s): 2acec29
Revert to /gradio_api/file= URL pattern — Gradio 5 file route
Browse files351 unmodified lines352353354355356357358355356357358359360361351 unmodified lines if not path.exists(): cache[name] = "" return "" # Use the legacy /file= route — works in both Gradio 4.x and 5.x and # avoids the /gradio_api/file= pattern which is only recognized by # newer Gradio routing. uri = f"/file={path.as_posix()}" # Gradio 5 serves static files at /gradio_api/file=<absolute-path>. # This works because we call gr.set_static_paths(assets) at module # scope below — the file route checks against that allowlist. uri = f"/gradio_api/file={path.as_posix()}" cache[name] = uri return uri
app.py+4-4