Spaces:
Sleeping
Sleeping
fix: disable Gradio SSR mode to prevent port 7861 conflict on HF Spaces
Browse files- .gitignore +9 -0
- app.py +5 -1
.gitignore
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.py[cod]
|
| 3 |
+
*$py.class
|
| 4 |
+
uploads/*
|
| 5 |
+
!uploads/.gitkeep
|
| 6 |
+
.env
|
| 7 |
+
.venv/
|
| 8 |
+
env/
|
| 9 |
+
venv/
|
app.py
CHANGED
|
@@ -11,6 +11,9 @@ import os
|
|
| 11 |
from pathlib import Path
|
| 12 |
import sys
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
# Ensure backend root and project root are on sys.path
|
| 15 |
CURRENT_DIR = Path(__file__).resolve().parent
|
| 16 |
if str(CURRENT_DIR) not in sys.path:
|
|
@@ -120,4 +123,5 @@ app = gr.mount_gradio_app(fastapi_app, demo, path="/")
|
|
| 120 |
|
| 121 |
if __name__ == "__main__":
|
| 122 |
port = int(os.environ.get("PORT", 7860))
|
| 123 |
-
|
|
|
|
|
|
| 11 |
from pathlib import Path
|
| 12 |
import sys
|
| 13 |
|
| 14 |
+
# Disable Gradio 5 SSR (Server-Side Rendering) mode to prevent it from spawning an internal Node.js server on port 7861
|
| 15 |
+
os.environ["GRADIO_SSR_MODE"] = "false"
|
| 16 |
+
|
| 17 |
# Ensure backend root and project root are on sys.path
|
| 18 |
CURRENT_DIR = Path(__file__).resolve().parent
|
| 19 |
if str(CURRENT_DIR) not in sys.path:
|
|
|
|
| 123 |
|
| 124 |
if __name__ == "__main__":
|
| 125 |
port = int(os.environ.get("PORT", 7860))
|
| 126 |
+
print(f"[GaiaScale Server] Starting server on 0.0.0.0:{port} (PORT env={os.environ.get('PORT')})")
|
| 127 |
+
uvicorn.run(app, host="0.0.0.0", port=port, reload=False)
|