mnawfal29 commited on
Commit
9b7f82f
·
verified ·
1 Parent(s): 320ea07

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +0 -1
  2. server/app.py +8 -15
README.md CHANGED
@@ -6,7 +6,6 @@ colorTo: blue
6
  sdk: docker
7
  pinned: true
8
  app_port: 8000
9
- base_path: /web
10
  tags:
11
  - openenv
12
  - reinforcement-learning
 
6
  sdk: docker
7
  pinned: true
8
  app_port: 8000
 
9
  tags:
10
  - openenv
11
  - reinforcement-learning
server/app.py CHANGED
@@ -56,28 +56,21 @@ app = create_app(
56
  max_concurrent_envs=4,
57
  )
58
 
59
- # Mount Gradio demo at /web.
60
- # SSR mode is disabled because Gradio's Node sidecar tends to 502 under HF
61
- # Spaces' Docker proxy; client-side rendering is more reliable. root_path is
62
- # set so relative asset URLs resolve correctly when HF iframes /web.
 
 
 
63
  try:
64
  import gradio as gr
65
  _demo = _build_demo_ui()
66
  app = gr.mount_gradio_app(
67
  app, _demo,
68
- path="/web",
69
- root_path="/web",
70
  ssr_mode=False,
71
  )
72
-
73
- # Redirect root and /web (no trailing slash) to /web/ so the HF Space
74
- # iframe works whether base_path is set or not.
75
- from fastapi.responses import RedirectResponse
76
-
77
- @app.get("/")
78
- def _root_redirect():
79
- return RedirectResponse(url="/web/")
80
-
81
  except Exception as _e: # pragma: no cover
82
  import logging
83
  logging.getLogger(__name__).warning(
 
56
  max_concurrent_envs=4,
57
  )
58
 
59
+ # Mount the Gradio demo at the root path.
60
+ #
61
+ # Mounting at "/" lets HF Spaces iframe the app directly without needing
62
+ # base_path in the README, and avoids the Gradio 5.x SSR sidecar that 502s
63
+ # under HF's Docker reverse proxy. FastAPI routes registered by create_app
64
+ # (/reset, /step, /schema, /openapi.json, /health, /ws) keep priority
65
+ # because they're exact-match and were registered BEFORE this mount.
66
  try:
67
  import gradio as gr
68
  _demo = _build_demo_ui()
69
  app = gr.mount_gradio_app(
70
  app, _demo,
71
+ path="/",
 
72
  ssr_mode=False,
73
  )
 
 
 
 
 
 
 
 
 
74
  except Exception as _e: # pragma: no cover
75
  import logging
76
  logging.getLogger(__name__).warning(