snikhilesh commited on
Commit
d60e3d7
·
verified ·
1 Parent(s): a6fd0ad

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. backend/main.py +18 -18
backend/main.py CHANGED
@@ -120,24 +120,6 @@ async def root():
120
  else:
121
  return {"message": "Medical Report Analysis Platform API", "version": "1.0.0"}
122
 
123
- # Catch-all route for React Router (single-page application)
124
- @app.get("/{full_path:path}")
125
- async def serve_react_app(full_path: str):
126
- """Serve React app for any non-API routes"""
127
- static_dir = Path(__file__).parent / "static"
128
- index_file = static_dir / "index.html"
129
-
130
- # Check if this is an API route or static file
131
- if (full_path.startswith(('api', 'health', 'analyze', 'status', 'results', 'supported-models', 'compliance-status', 'assets'))):
132
- raise HTTPException(status_code=404, detail="API endpoint not found")
133
-
134
- # Serve React app for everything else (client-side routing)
135
- if index_file.exists():
136
- return FileResponse(index_file)
137
- else:
138
- raise HTTPException(status_code=404, detail="React app not found")
139
-
140
-
141
  @app.get("/health")
142
  async def health_check():
143
  """Detailed health check with component status"""
@@ -465,6 +447,24 @@ async def process_document_pipeline(job_id: str, file_path: str, filename: str,
465
  data_encryption.secure_delete(file_path)
466
 
467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  if __name__ == "__main__":
469
  import uvicorn
470
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
120
  else:
121
  return {"message": "Medical Report Analysis Platform API", "version": "1.0.0"}
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  @app.get("/health")
124
  async def health_check():
125
  """Detailed health check with component status"""
 
447
  data_encryption.secure_delete(file_path)
448
 
449
 
450
+ # Catch-all route for React Router (single-page application) - MUST BE LAST
451
+ @app.get("/{full_path:path}")
452
+ async def serve_react_app(full_path: str):
453
+ """Serve React app for any non-API routes"""
454
+ static_dir = Path(__file__).parent / "static"
455
+ index_file = static_dir / "index.html"
456
+
457
+ # Check if this is an API route or static file
458
+ if (full_path.startswith(('api', 'health', 'analyze', 'status', 'results', 'supported-models', 'compliance-status', 'assets'))):
459
+ raise HTTPException(status_code=404, detail="API endpoint not found")
460
+
461
+ # Serve React app for everything else (client-side routing)
462
+ if index_file.exists():
463
+ return FileResponse(index_file)
464
+ else:
465
+ raise HTTPException(status_code=404, detail="React app not found")
466
+
467
+
468
  if __name__ == "__main__":
469
  import uvicorn
470
  uvicorn.run(app, host="0.0.0.0", port=7860)