Spaces:
Sleeping
Sleeping
Commit ·
b8a407c
1
Parent(s): 1f3364e
idk
Browse files
app.py
CHANGED
|
@@ -263,20 +263,4 @@ with gr.Blocks() as demo:
|
|
| 263 |
)
|
| 264 |
|
| 265 |
# ---------- 3. FastAPI layer --------------------------------------------------
|
| 266 |
-
|
| 267 |
-
user_id:str
|
| 268 |
-
docs:list[str]
|
| 269 |
-
|
| 270 |
-
class QueryReq(BaseModel):
|
| 271 |
-
user_id:str
|
| 272 |
-
question:str
|
| 273 |
-
|
| 274 |
-
api = FastAPI()
|
| 275 |
-
api = gr.mount_gradio_app(api, demo, path="/")
|
| 276 |
-
|
| 277 |
-
# ---------- 5. run both (FastAPI + Gradio) -----------------------------------
|
| 278 |
-
if __name__ == "__main__":
|
| 279 |
-
# launch Gradio on a background thread
|
| 280 |
-
demo.queue().launch(share=False, prevent_thread_lock=True)
|
| 281 |
-
# then start FastAPI (uvicorn blocks main thread)
|
| 282 |
-
uvicorn.run(api, host="0.0.0.0", port=8000)
|
|
|
|
| 263 |
)
|
| 264 |
|
| 265 |
# ---------- 3. FastAPI layer --------------------------------------------------
|
| 266 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|