Zhen Ye commited on
Commit
22ef6b4
·
1 Parent(s): ff50694

fix: Update static file path for deployment

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -104,9 +104,11 @@ async def add_no_cache_header(request: Request, call_next):
104
  return response
105
 
106
  # Optional: serve the LaserPerception frontend from this backend.
107
- _LASER_DIR = Path(__file__).with_name("LaserPerception")
108
- if _LASER_DIR.exists():
109
- app.mount("/laser", StaticFiles(directory=_LASER_DIR), name="laser")
 
 
110
 
111
  # Valid detection modes
112
  VALID_MODES = {"object_detection", "segmentation", "drone_detection"}
@@ -159,7 +161,8 @@ def _default_queries_for_mode(mode: str) -> list[str]:
159
  @app.get("/", response_class=HTMLResponse)
160
  async def demo_page():
161
  """Redirect to LaserPerception app."""
162
- return RedirectResponse(url="/laser/LaserPerception.html")
 
163
 
164
 
165
  @app.post("/detect")
 
104
  return response
105
 
106
  # Optional: serve the LaserPerception frontend from this backend.
107
+ # The frontend files are now located in the 'frontend' directory.
108
+ _FRONTEND_DIR = Path(__file__).with_name("frontend")
109
+ if _FRONTEND_DIR.exists():
110
+ # Mount the entire frontend directory at /laser (legacy path) or /frontend
111
+ app.mount("/laser", StaticFiles(directory=_FRONTEND_DIR, html=True), name="laser")
112
 
113
  # Valid detection modes
114
  VALID_MODES = {"object_detection", "segmentation", "drone_detection"}
 
161
  @app.get("/", response_class=HTMLResponse)
162
  async def demo_page():
163
  """Redirect to LaserPerception app."""
164
+ # The main entry point is now index.html in the mounted directory
165
+ return RedirectResponse(url="/laser/index.html")
166
 
167
 
168
  @app.post("/detect")