norhan12 commited on
Commit
545eb49
·
verified ·
1 Parent(s): e5f63f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -90,8 +90,9 @@ async def process_audio(request: ProcessAudioRequest = Body(...)):
90
  f"Anxiety: {voice.get('anxiety_level', 'N/A')}"
91
  )
92
 
93
- json_url = f"{BASE_URL}/json/{json_dest_name}"
94
- pdf_url = f"{BASE_URL}/pdf/{pdf_dest_name}"
 
95
 
96
  os.remove(local_path)
97
 
@@ -101,7 +102,7 @@ async def process_audio(request: ProcessAudioRequest = Body(...)):
101
  raise HTTPException(status_code=500, detail=str(e))
102
 
103
 
104
- @app.get("/outputs/json/{filename}")
105
  async def get_json_file(filename: str):
106
  file_path = os.path.join(JSON_DIR, filename)
107
  if not os.path.exists(file_path):
@@ -109,9 +110,9 @@ async def get_json_file(filename: str):
109
  return FileResponse(file_path, media_type="application/json", filename=filename)
110
 
111
 
112
- @app.get("/outputs/pdf/{filename}")
113
  async def get_pdf_file(filename: str):
114
  file_path = os.path.join(PDF_DIR, filename)
115
  if not os.path.exists(file_path):
116
  raise HTTPException(status_code=404, detail="PDF file not found")
117
- return FileResponse(file_path, media_type="application/pdf", filename=filename)
 
90
  f"Anxiety: {voice.get('anxiety_level', 'N/A')}"
91
  )
92
 
93
+ json_url = f"{BASE_URL}/static/outputs/json/{json_dest_name}"
94
+ pdf_url = f"{BASE_URL}/static/outputs/pdf/{pdf_dest_name}"
95
+
96
 
97
  os.remove(local_path)
98
 
 
102
  raise HTTPException(status_code=500, detail=str(e))
103
 
104
 
105
+ @app.get("/static/outputs/json/{filename}")
106
  async def get_json_file(filename: str):
107
  file_path = os.path.join(JSON_DIR, filename)
108
  if not os.path.exists(file_path):
 
110
  return FileResponse(file_path, media_type="application/json", filename=filename)
111
 
112
 
113
+ @app.get("/static/outputs/pdf/{filename}")
114
  async def get_pdf_file(filename: str):
115
  file_path = os.path.join(PDF_DIR, filename)
116
  if not os.path.exists(file_path):
117
  raise HTTPException(status_code=404, detail="PDF file not found")
118
+ return FileResponse(file_path, media_type="application/pdf", filename=filename)