Spaces:
Running
Running
Add debug listing to download endpoint
Browse files
app.py
CHANGED
|
@@ -356,7 +356,20 @@ async def download_result(path: str = Query(...)):
|
|
| 356 |
return JSONResponse({"error": "forbidden path"}, status_code=403)
|
| 357 |
|
| 358 |
if not os.path.isfile(path):
|
| 359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
|
| 361 |
return FileResponse(path, media_type="video/mp4", filename=os.path.basename(path))
|
| 362 |
|
|
|
|
| 356 |
return JSONResponse({"error": "forbidden path"}, status_code=403)
|
| 357 |
|
| 358 |
if not os.path.isfile(path):
|
| 359 |
+
existing = glob.glob("/tmp/musetalk_*")
|
| 360 |
+
files_in_dirs = []
|
| 361 |
+
|
| 362 |
+
for d in existing:
|
| 363 |
+
if os.path.isdir(d):
|
| 364 |
+
for f in os.listdir(d):
|
| 365 |
+
files_in_dirs.append(os.path.join(d, f))
|
| 366 |
+
|
| 367 |
+
return JSONResponse({
|
| 368 |
+
"error": "file not found",
|
| 369 |
+
"requested": path,
|
| 370 |
+
"musetalk_dirs": existing[:10],
|
| 371 |
+
"files_in_dirs": files_in_dirs[:20],
|
| 372 |
+
}, status_code=404)
|
| 373 |
|
| 374 |
return FileResponse(path, media_type="video/mp4", filename=os.path.basename(path))
|
| 375 |
|