Spaces:
Running
Running
Commit ·
f2d4db5
1
Parent(s): ac00fb3
Fix InvalidPathError: whitelist OUT_DIR for Gradio 5 file serving
Browse filesGradio 5's launch() only serves files from the CWD, the system temp dir, or
allowed_paths. Generated images/docx are written under config.OUT_DIR
(/data/out on HF persistent storage), so returning those paths from the
pipeline made the Gallery/File outputs raise InvalidPathError right after
generation finished. Pass allowed_paths=[str(config.OUT_DIR)] to launch();
Gradio's allowlist check is an ancestor-or-equal match, so this one entry
covers every per-run subfolder.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -140,4 +140,7 @@ if __name__ == "__main__":
|
|
| 140 |
server_name="0.0.0.0",
|
| 141 |
server_port=7860,
|
| 142 |
show_api=False, # avoid API-schema generation edge cases
|
|
|
|
|
|
|
|
|
|
| 143 |
)
|
|
|
|
| 140 |
server_name="0.0.0.0",
|
| 141 |
server_port=7860,
|
| 142 |
show_api=False, # avoid API-schema generation edge cases
|
| 143 |
+
# Generated images/docx live under config.OUT_DIR (e.g. /data/out on HF
|
| 144 |
+
# persistent storage), which Gradio 5's file-serving allowlist otherwise rejects.
|
| 145 |
+
allowed_paths=[str(config.OUT_DIR)],
|
| 146 |
)
|