Ajayyy00 commited on
Commit
eb1ddd0
·
1 Parent(s): 34f097c

Fix HuggingFace Space dashboard deployment (aiofiles, mount root)

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. dashboard_server.py +7 -0
  3. requirements.txt +2 -0
Dockerfile CHANGED
@@ -16,4 +16,4 @@ COPY --chown=user . /app
16
 
17
  # The hackathon expects the OpenEnv Server to run on 7860 for Spaces Gradio endpoints
18
  # We will use uvicorn to host the app which complies with the spec
19
- CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]
 
16
 
17
  # The hackathon expects the OpenEnv Server to run on 7860 for Spaces Gradio endpoints
18
  # We will use uvicorn to host the app which complies with the spec
19
+ CMD ["uvicorn", "dashboard_server:app", "--host", "0.0.0.0", "--port", "7860"]
dashboard_server.py CHANGED
@@ -45,7 +45,14 @@ dashboard_dir = os.path.join(ROOT, "dashboard")
45
  if os.path.isdir(dashboard_dir):
46
  try:
47
  from fastapi.staticfiles import StaticFiles
 
 
48
  app.mount("/dashboard", StaticFiles(directory=dashboard_dir, html=True), name="dashboard")
 
 
 
 
 
49
  _STATIC_OK = True
50
  except ImportError:
51
  _STATIC_OK = False
 
45
  if os.path.isdir(dashboard_dir):
46
  try:
47
  from fastapi.staticfiles import StaticFiles
48
+ from fastapi.responses import RedirectResponse
49
+
50
  app.mount("/dashboard", StaticFiles(directory=dashboard_dir, html=True), name="dashboard")
51
+
52
+ @app.get("/")
53
+ def root_redirect():
54
+ return RedirectResponse(url="/dashboard/")
55
+
56
  _STATIC_OK = True
57
  except ImportError:
58
  _STATIC_OK = False
requirements.txt CHANGED
@@ -6,3 +6,5 @@ websockets
6
  openai
7
  tenacity
8
  openenv-core
 
 
 
6
  openai
7
  tenacity
8
  openenv-core
9
+
10
+ aiofiles