Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -124,10 +124,19 @@ img_interface = gr.Interface(
|
|
| 124 |
title="π¨ AI Image Question Answering"
|
| 125 |
)
|
| 126 |
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
@app.get("/")
|
| 132 |
def home():
|
| 133 |
return RedirectResponse(url="/")
|
|
|
|
| 124 |
title="π¨ AI Image Question Answering"
|
| 125 |
)
|
| 126 |
|
| 127 |
+
# Use Gradio Blocks (instead of TabbedInterface)
|
| 128 |
+
with gr.Blocks() as demo:
|
| 129 |
+
gr.TabbedLayout(
|
| 130 |
+
[doc_interface, img_interface],
|
| 131 |
+
["π Document QA", "π¨ Image QA"]
|
| 132 |
+
)
|
| 133 |
+
|
| 134 |
+
# Mount Gradio to FastAPI properly
|
| 135 |
+
from gradio.routes import App as GradioApp
|
| 136 |
+
gradio_app = GradioApp.create_app(demo)
|
| 137 |
+
app.mount("/", gradio_app)
|
| 138 |
+
|
| 139 |
+
# Redirect FastAPI root to Gradio UI
|
| 140 |
@app.get("/")
|
| 141 |
def home():
|
| 142 |
return RedirectResponse(url="/")
|