CWM-Coder724 commited on
Commit ·
467801a
1
Parent(s): eee320b
Disable Gradio 5 SSR mode to prevent port 7860 conflict
Browse files
app.py
CHANGED
|
@@ -31,31 +31,13 @@ if HAS_ZEROGPU:
|
|
| 31 |
title="Clash of Minds — AI Debate Judge",
|
| 32 |
)
|
| 33 |
|
| 34 |
-
# Mount Gradio interface under /gradio
|
| 35 |
-
app = gr.mount_gradio_app(fastapi_app, demo, path="/gradio")
|
| 36 |
print("[HuggingFace] ZeroGPU & Gradio interface mounted at /gradio successfully.")
|
| 37 |
else:
|
| 38 |
demo = None
|
| 39 |
app = fastapi_app
|
| 40 |
|
| 41 |
if __name__ == "__main__":
|
| 42 |
-
import subprocess
|
| 43 |
-
try:
|
| 44 |
-
print("[HF PS]\n" + subprocess.run(["ps", "aux"], capture_output=True, text=True).stdout)
|
| 45 |
-
print("[HF SS]\n" + subprocess.run(["ss", "-tulpn"], capture_output=True, text=True).stdout)
|
| 46 |
-
except Exception as e:
|
| 47 |
-
print("[HF Diag Error]", e)
|
| 48 |
-
|
| 49 |
port = int(os.environ.get("PORT", 7860))
|
| 50 |
-
|
| 51 |
-
uvicorn.run(app, host="0.0.0.0", port=port)
|
| 52 |
-
except Exception as e:
|
| 53 |
-
print("[HF Uvicorn Error]", e)
|
| 54 |
-
# Try next available port
|
| 55 |
-
for fallback_port in [7861, 8000, 8080]:
|
| 56 |
-
try:
|
| 57 |
-
print(f"[HF Fallback] Attempting port {fallback_port}...")
|
| 58 |
-
uvicorn.run(app, host="0.0.0.0", port=fallback_port)
|
| 59 |
-
break
|
| 60 |
-
except Exception as fe:
|
| 61 |
-
print(f"[HF Fallback Error {fallback_port}]", fe)
|
|
|
|
| 31 |
title="Clash of Minds — AI Debate Judge",
|
| 32 |
)
|
| 33 |
|
| 34 |
+
# Mount Gradio interface under /gradio with ssr_mode=False to prevent Node.js port conflict
|
| 35 |
+
app = gr.mount_gradio_app(fastapi_app, demo, path="/gradio", ssr_mode=False)
|
| 36 |
print("[HuggingFace] ZeroGPU & Gradio interface mounted at /gradio successfully.")
|
| 37 |
else:
|
| 38 |
demo = None
|
| 39 |
app = fastapi_app
|
| 40 |
|
| 41 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
port = int(os.environ.get("PORT", 7860))
|
| 43 |
+
uvicorn.run(app, host="0.0.0.0", port=port)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|