Spaces:
Running on Zero
Running on Zero
Commit ·
9a6056f
1
Parent(s): 418300b
Fix demo load: copy bundled clip to a temp file for Gradio cache
Browse filesallowed_paths got past the 403, but Gradio 6 then refused to move the
bundled examples/pushback_demo.mp3 into its cache ('not uploaded by a
user'). Copy it to a per-request temp dir first so Gradio caches and
serves it like a normal upload, so 'Try the demo' loads and analyzes.
app.py
CHANGED
|
@@ -271,8 +271,16 @@ def finish_song(audio_path, total_seconds, vibe, remaster,
|
|
| 271 |
|
| 272 |
|
| 273 |
def load_demo():
|
| 274 |
-
"""Load the PUSHBACK demo clip into the uploader.
|
| 275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
|
| 277 |
|
| 278 |
# --- ethereal "dark studio" theme --------------------------------------------
|
|
|
|
| 271 |
|
| 272 |
|
| 273 |
def load_demo():
|
| 274 |
+
"""Load the PUSHBACK demo clip into the uploader.
|
| 275 |
+
|
| 276 |
+
Copy the bundled clip to a fresh temp file and hand THAT to the uploader.
|
| 277 |
+
Gradio 6 refuses to move a non-user-uploaded bundled file into its cache
|
| 278 |
+
("…was not uploaded by a user"), which broke the demo on the Space; a file
|
| 279 |
+
in a per-request temp dir is one Gradio will cache and serve normally."""
|
| 280 |
+
import shutil
|
| 281 |
+
dst = os.path.join(tempfile.mkdtemp(), os.path.basename(PUSHBACK_DEMO))
|
| 282 |
+
shutil.copyfile(PUSHBACK_DEMO, dst)
|
| 283 |
+
return dst
|
| 284 |
|
| 285 |
|
| 286 |
# --- ethereal "dark studio" theme --------------------------------------------
|