gradio_fastapi / app.py
lanbogao's picture
Update app.py
b975982
raw
history blame contribute delete
437 Bytes
from fastapi import FastAPI
import gradio as gr
import uvicorn
CUSTOM_PATH = "/gradio"
app = FastAPI()
@app.get("/")
def read_main():
return {"message": "This is your main app"}
io = gr.Interface(lambda x: "Hello, " + x + "!", "textbox", "textbox")
#gradio_app = gr.routes.App.create_app(io)
#app.mount(CUSTOM_PATH, gradio_app)
app = gr.mount_gradio_app(app, io, path=CUSTOM_PATH)
uvicorn.run(app, host="0.0.0.0", port=7860)