Custom Components GalleryNEW
ExploreCustom Components GalleryNEW
ExploreNew to Gradio? Start here: Getting Started
See the Release History
gradio.mount_gradio_app(app, blocks, path, ยทยทยท)
from fastapi import FastAPI
import gradio as gr
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="/gradio")
# Then run `uvicorn run:app` from the terminal and navigate to http://localhost:8000/gradio.
Parameter | Description |
---|---|
app fastapi.FastAPI required | The parent FastAPI application. |
blocks gradio.Blocks required | The blocks object we want to mount to the parent app. |
path str required | The path at which the gradio application will be mounted. |
app_kwargs dict[str, Any] | None default: None | Additional keyword arguments to pass to the underlying FastAPI app as a dictionary of parameter keys and argument values. For example, |