Eakempreet commited on
Commit
8d85c54
·
1 Parent(s): 9cebea9

Serve HUD from FastAPI + lock CORS to HF Space URL

Browse files
Files changed (1) hide show
  1. app/main.py +8 -0
app/main.py CHANGED
@@ -61,6 +61,14 @@ app.add_middleware(
61
  # This prevents random websites from hitting your /analyze endpoint
62
 
63
 
 
 
 
 
 
 
 
 
64
  # Function to take the inputs
65
  # image -> as temp file
66
  # 8 features -> form object
 
61
  # This prevents random websites from hitting your /analyze endpoint
62
 
63
 
64
+ # When a browser visits the Space URL, it sends GET /
65
+ # This route catches that request and returns the HUD HTML file
66
+ # FileResponse reads the file from disk and sends it with the correct content type
67
+ # so the browser knows to render it as a webpage, not download it
68
+ @app.get("/")
69
+ async def serve_hud():
70
+ return FileResponse("frontend/atas_hud_v11.html")
71
+
72
  # Function to take the inputs
73
  # image -> as temp file
74
  # 8 features -> form object