kadsai commited on
Commit
f88030b
·
verified ·
1 Parent(s): f4d9136

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -17,6 +17,7 @@ import threading
17
  import base64
18
  from PIL import Image
19
  from io import BytesIO
 
20
 
21
 
22
  # Activation du logging HTTP pour OpenAI
@@ -371,6 +372,9 @@ app_api.add_middleware(
371
  allow_headers=["*"],
372
  )
373
 
 
 
 
374
  # Schéma pour requêtes
375
  class ChatRequest(BaseModel):
376
  message: str
@@ -400,13 +404,12 @@ def chat(request: ChatRequest):
400
 
401
 
402
  def run_fastapi():
403
- uvicorn.run(app_api)
404
 
405
  #threading.Thread(target=run_fastapi, daemon=True).start()
406
 
407
 
408
  # --- Lancement serveur
409
  if __name__ == "__main__":
410
- # threading.Thread(target=run_fastapi, daemon=True).start()
411
- # app.launch(server_name="0.0.0.0", server_port=7860)
412
- uvicorn.run(app_api)
 
17
  import base64
18
  from PIL import Image
19
  from io import BytesIO
20
+ from gradio.routes import mount_gradio_app
21
 
22
 
23
  # Activation du logging HTTP pour OpenAI
 
372
  allow_headers=["*"],
373
  )
374
 
375
+
376
+ gradio_app = app # 'app' correspond à ton interface gradio.Blocks existante
377
+ app_api = mount_gradio_app(app=app_api, blocks=gradio_app, path="/")
378
  # Schéma pour requêtes
379
  class ChatRequest(BaseModel):
380
  message: str
 
404
 
405
 
406
  def run_fastapi():
407
+ uvicorn.run(app_api,host="0.0.0.0",port:8000)
408
 
409
  #threading.Thread(target=run_fastapi, daemon=True).start()
410
 
411
 
412
  # --- Lancement serveur
413
  if __name__ == "__main__":
414
+ uvicorn.run(api, host="0.0.0.0", port=7860)
415
+ #app.launch(server_name="0.0.0.0", server_port=7860)