Spaces:
Running
Running
Update Summarization/main.py
Browse files- Summarization/main.py +6 -4
Summarization/main.py
CHANGED
@@ -41,9 +41,11 @@ async def caption(file: UploadFile = File(...)):
|
|
41 |
except Exception as e:
|
42 |
return JSONResponse({"error": str(e)}, status_code=500)
|
43 |
|
44 |
-
@app.get("/files/{filename}")
|
45 |
async def serve_file(filename: str):
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
49 |
return JSONResponse({"error": "File not found"}, status_code=404)
|
|
|
|
41 |
except Exception as e:
|
42 |
return JSONResponse({"error": str(e)}, status_code=500)
|
43 |
|
44 |
+
@app.get("/files/{filename}")
|
45 |
async def serve_file(filename: str):
|
46 |
+
file_dir = os.path.join(tempfile.gettempdir(), "aidan_files")
|
47 |
+
file_path = os.path.join(file_dir, filename)
|
48 |
+
if os.path.exists(file_path):
|
49 |
+
return FileResponse(file_path)
|
50 |
return JSONResponse({"error": "File not found"}, status_code=404)
|
51 |
+
|