ikraamkb commited on
Commit
477b1e1
·
verified ·
1 Parent(s): 31250b8

Update Summarization/main.py

Browse files
Files changed (1) hide show
  1. Summarization/main.py +8 -5
Summarization/main.py CHANGED
@@ -43,9 +43,12 @@ async def caption(file: UploadFile = File(...)):
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
 
 
 
43
 
44
  @app.get("/files/{filename}")
45
  async def serve_file(filename: str):
46
+ filepath = os.path.join(tempfile.gettempdir(), filename)
47
+ altpath = os.path.join(tempfile.gettempdir(), "aidan_files", filename)
48
+
49
+ if os.path.exists(filepath):
50
+ return FileResponse(filepath)
51
+ elif os.path.exists(altpath):
52
+ return FileResponse(altpath)
53
 
54
+ return JSONResponse({"error": "File not found"}, status_code=404)