Spaces:
Running on Zero
Running on Zero
Manmay Nakhashi commited on
Commit ·
9165469
1
Parent(s): f9cfdad
Default Gradio server to port 7860 (HF Spaces gateway expects this)
Browse filesThe previous default of 7861 caused HF's reverse proxy to return 500
for every external request: the app's internal HEAD localhost:7861
succeeded so the runtime stage stayed RUNNING, but no traffic from
huggingface.co/spaces or *.hf.space ever reached the container.
app.py
CHANGED
|
@@ -188,7 +188,9 @@ with gr.Blocks(
|
|
| 188 |
|
| 189 |
|
| 190 |
if __name__ == "__main__":
|
| 191 |
-
port
|
|
|
|
|
|
|
| 192 |
app.queue(max_size=10).launch(
|
| 193 |
server_name="0.0.0.0", server_port=port,
|
| 194 |
share=os.environ.get("GRADIO_SHARE", "0") == "1",
|
|
|
|
| 188 |
|
| 189 |
|
| 190 |
if __name__ == "__main__":
|
| 191 |
+
# HF Spaces routes external traffic to container port 7860 by default.
|
| 192 |
+
# Defaulting to 7861 caused the gateway to return 500 for every external request.
|
| 193 |
+
port = int(os.environ.get("GRADIO_SERVER_PORT", "7860"))
|
| 194 |
app.queue(max_size=10).launch(
|
| 195 |
server_name="0.0.0.0", server_port=port,
|
| 196 |
share=os.environ.get("GRADIO_SHARE", "0") == "1",
|