Update hf_demo.py
Browse files- hf_demo.py +9 -1
hf_demo.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
# hf_demo.py – ARF v4 API with Gradio frontend (optional)
|
| 2 |
import logging
|
| 3 |
import uuid
|
|
|
|
| 4 |
from datetime import datetime, timezone
|
| 5 |
from typing import Dict, Any, Optional
|
| 6 |
|
|
@@ -218,4 +219,11 @@ with gr.Blocks(title="ARF v4 Demo") as demo:
|
|
| 218 |
history_btn.click(fn=lambda: decision_history[-10:], outputs=decision_output)
|
| 219 |
|
| 220 |
# Mount Gradio app at the root path
|
| 221 |
-
app = gr.mount_gradio_app(app, demo, path="/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# hf_demo.py – ARF v4 API with Gradio frontend (optional)
|
| 2 |
import logging
|
| 3 |
import uuid
|
| 4 |
+
import os
|
| 5 |
from datetime import datetime, timezone
|
| 6 |
from typing import Dict, Any, Optional
|
| 7 |
|
|
|
|
| 219 |
history_btn.click(fn=lambda: decision_history[-10:], outputs=decision_output)
|
| 220 |
|
| 221 |
# Mount Gradio app at the root path
|
| 222 |
+
app = gr.mount_gradio_app(app, demo, path="/")
|
| 223 |
+
|
| 224 |
+
# ========================= ENTRY POINT =========================
|
| 225 |
+
# This ensures the server starts and stays alive when the script is run directly.
|
| 226 |
+
if __name__ == "__main__":
|
| 227 |
+
import uvicorn
|
| 228 |
+
port = int(os.environ.get("PORT", 7860))
|
| 229 |
+
uvicorn.run(app, host="0.0.0.0", port=port)
|