sebbe60 commited on
Commit
2bb162a
·
verified ·
1 Parent(s): 07a34ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -127,8 +127,11 @@ if __name__ == "__main__":
127
  # startup (required for free ZeroGPU Spaces).
128
  server_app = platform_status.server_app
129
  existing_route_count = len(server_app.router.routes)
130
- server_app.add_api_route("/health", health, methods=["GET"])
131
- server_app.add_api_route("/v1/detect", detect, methods=["POST"])
 
 
 
132
  echo_routes = server_app.router.routes[existing_route_count:]
133
  server_app.router.routes = echo_routes + server_app.router.routes[:existing_route_count]
134
  platform_status.block_thread()
 
127
  # startup (required for free ZeroGPU Spaces).
128
  server_app = platform_status.server_app
129
  existing_route_count = len(server_app.router.routes)
130
+ # A ZeroGPU Space's Node frontend forwards this prefix to Gradio's
131
+ # Python server. Keep the Docker deployment's routes at the root while
132
+ # exposing equivalent Space routes through the forwarded API prefix.
133
+ server_app.add_api_route("/gradio_api/health", health, methods=["GET"])
134
+ server_app.add_api_route("/gradio_api/v1/detect", detect, methods=["POST"])
135
  echo_routes = server_app.router.routes[existing_route_count:]
136
  server_app.router.routes = echo_routes + server_app.router.routes[:existing_route_count]
137
  platform_status.block_thread()