petter2025 commited on
Commit
89e9867
·
verified ·
1 Parent(s): 1da74ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
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
- # Correct order: first the FastAPI app, then the Gradio blocks.
 
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.