Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
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 |
-
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
| 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()
|