import uvicorn import calc_fast_api import gradio_app import threading # Start FastAPI in a separate thread def start_fastapi(): uvicorn.run("calc_fast_api:app", host="0.0.0.0", port=8000) # Start FastAPI thread fastapi_thread = threading.Thread(target= start_fastapi) fastapi_thread.start() gradio_app.launch_gradio()