Update app.py
Browse files
app.py
CHANGED
|
@@ -218,8 +218,13 @@ with gr.Blocks(title="ARF v4 Demo") as demo:
|
|
| 218 |
history_btn.click(fn=lambda: decision_history[-10:], outputs=decision_output)
|
| 219 |
|
| 220 |
# ========================= Mount FastAPI under /api =========================
|
| 221 |
-
|
|
|
|
| 222 |
app = gr.mount_gradio_app(fastapi_app, demo, path="/api")
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
# Note: No manual server start. Hugging Face will serve this `app` (which is a FastAPI app with Gradio mounted)
|
| 225 |
# and the Gradio interface will be at the root, API endpoints under /api.
|
|
|
|
| 218 |
history_btn.click(fn=lambda: decision_history[-10:], outputs=decision_output)
|
| 219 |
|
| 220 |
# ========================= Mount FastAPI under /api =========================
|
| 221 |
+
|
| 222 |
+
# Mount FastAPI under /api
|
| 223 |
app = gr.mount_gradio_app(fastapi_app, demo, path="/api")
|
| 224 |
|
| 225 |
+
# This starts the server and keeps it alive
|
| 226 |
+
if __name__ == "__main__":
|
| 227 |
+
demo.queue().launch(server_name="0.0.0.0", server_port=7860)
|
| 228 |
+
|
| 229 |
# Note: No manual server start. Hugging Face will serve this `app` (which is a FastAPI app with Gradio mounted)
|
| 230 |
# and the Gradio interface will be at the root, API endpoints under /api.
|