nuevo_space / main.py
Moibe's picture
Create main.py
68314c3 verified
raw
history blame contribute delete
561 Bytes
#Básicamente aquí una de las rutas de FastAPI envía a la interfaz generada en gradio para que coexistan.
from fastapi import FastAPI
import gradio as gr
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")
app = gr.mount_gradio_app(app, io, path=CUSTOM_PATH)
# Run this from the terminal as you would normally start a FastAPI app: `uvicorn run:app`
# and navigate to http://localhost:8000/gradio in your browser.