Update app.py
Browse files
app.py
CHANGED
|
@@ -218,13 +218,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 FastAPI under /api =========================
|
| 221 |
-
|
| 222 |
-
#
|
|
|
|
|
|
|
| 223 |
app = gr.mount_gradio_app(fastapi_app, demo, path="/api")
|
| 224 |
|
| 225 |
-
#
|
| 226 |
-
|
| 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.
|
|
|
|
| 218 |
history_btn.click(fn=lambda: decision_history[-10:], outputs=decision_output)
|
| 219 |
|
| 220 |
# ========================= Mount FastAPI under /api =========================
|
| 221 |
+
# This mounts the Gradio interface onto the FastAPI app.
|
| 222 |
+
# The resulting `app` is a FastAPI application that serves both:
|
| 223 |
+
# - The API at `/api` (and its subpaths)
|
| 224 |
+
# - The Gradio UI at the root `/`
|
| 225 |
app = gr.mount_gradio_app(fastapi_app, demo, path="/api")
|
| 226 |
|
| 227 |
+
# Note: No manual server start! The Dockerfile will run uvicorn on this `app` object.
|
| 228 |
+
# Make sure your Dockerfile's CMD is: CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|