ikraamkb commited on
Commit
fbf2ce7
Β·
verified Β·
1 Parent(s): cdbab24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -124,10 +124,19 @@ img_interface = gr.Interface(
124
  title="🎨 AI Image Question Answering"
125
  )
126
 
127
- demo = gr.TabbedInterface([doc_interface, img_interface], ["πŸ“„ Document QA", "🎨 Image QA"])
128
-
129
- app = gr.mount_gradio_app(app, demo, path="/")
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="/")