Hermes Bot commited on
fix: call demo.launch() on HF Spaces to keep process alive
Browse files- projects/tinybard/app.py +2 -2
projects/tinybard/app.py
CHANGED
|
@@ -627,9 +627,9 @@ app = mount_gradio_app(fastapi_app, demo, path="/gradio")
|
|
| 627 |
# Entrypoint
|
| 628 |
# ---------------------------------------------------------------------------
|
| 629 |
if __name__ == "__main__":
|
| 630 |
-
# On HF Spaces, Gradio manages the server — don't start uvicorn.
|
| 631 |
if os.environ.get("SPACE_ID"):
|
| 632 |
-
log.info("Running on HF Spaces — Gradio
|
|
|
|
| 633 |
else:
|
| 634 |
import uvicorn
|
| 635 |
port = int(os.environ.get("PORT", "7860"))
|
|
|
|
| 627 |
# Entrypoint
|
| 628 |
# ---------------------------------------------------------------------------
|
| 629 |
if __name__ == "__main__":
|
|
|
|
| 630 |
if os.environ.get("SPACE_ID"):
|
| 631 |
+
log.info("Running on HF Spaces — launching Gradio server.")
|
| 632 |
+
demo.launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", "7860")))
|
| 633 |
else:
|
| 634 |
import uvicorn
|
| 635 |
port = int(os.environ.get("PORT", "7860"))
|