Spaces:
Sleeping
Sleeping
I766446 commited on
Commit ·
79817cf
1
Parent(s): f4683b4
final3
Browse files
app.py
CHANGED
|
@@ -35,7 +35,18 @@ demo = gr.Interface(
|
|
| 35 |
)
|
| 36 |
|
| 37 |
# Mount Gradio onto the FastAPI app so both are served on the same port
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
if __name__ == "__main__":
|
| 41 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
| 35 |
)
|
| 36 |
|
| 37 |
# Mount Gradio onto the FastAPI app so both are served on the same port
|
| 38 |
+
from fastapi import FastAPI
|
| 39 |
+
import gradio as gr
|
| 40 |
+
from server import app as fastapi_app
|
| 41 |
+
|
| 42 |
+
# Create root app
|
| 43 |
+
app = FastAPI()
|
| 44 |
+
|
| 45 |
+
# Mount FastAPI API at root
|
| 46 |
+
app.mount("/", fastapi_app)
|
| 47 |
+
|
| 48 |
+
# Mount Gradio UI separately
|
| 49 |
+
app = gr.mount_gradio_app(app, demo, path="/ui")
|
| 50 |
|
| 51 |
if __name__ == "__main__":
|
| 52 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|