Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -811,9 +811,8 @@ def create_gradio_interface():
|
|
| 811 |
# Create Gradio app
|
| 812 |
gradio_app = create_gradio_interface()
|
| 813 |
|
| 814 |
-
# Mount Gradio
|
| 815 |
-
|
| 816 |
-
app.mount("/ui", WSGIMiddleware(gradio_app.server))
|
| 817 |
|
| 818 |
# Enhanced root endpoint that explains the API structure
|
| 819 |
@app.get("/")
|
|
@@ -858,12 +857,11 @@ if __name__ == "__main__":
|
|
| 858 |
|
| 859 |
# On Hugging Face, we need to run only one server
|
| 860 |
# Gradio will be mounted at /ui, FastAPI at root
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
quiet=False
|
| 867 |
)
|
| 868 |
else:
|
| 869 |
# Local development - run separate servers
|
|
|
|
| 811 |
# Create Gradio app
|
| 812 |
gradio_app = create_gradio_interface()
|
| 813 |
|
| 814 |
+
# FIXED: Mount Gradio correctly - Create a separate FastAPI app for Gradio
|
| 815 |
+
gradio_fastapi_app = gr.mount_gradio_app(app, gradio_app, path="/ui")
|
|
|
|
| 816 |
|
| 817 |
# Enhanced root endpoint that explains the API structure
|
| 818 |
@app.get("/")
|
|
|
|
| 857 |
|
| 858 |
# On Hugging Face, we need to run only one server
|
| 859 |
# Gradio will be mounted at /ui, FastAPI at root
|
| 860 |
+
uvicorn.run(
|
| 861 |
+
app,
|
| 862 |
+
host="0.0.0.0",
|
| 863 |
+
port=7860,
|
| 864 |
+
log_level="info"
|
|
|
|
| 865 |
)
|
| 866 |
else:
|
| 867 |
# Local development - run separate servers
|