mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
9b42ba8f10
* changes * changes * revert changes * changes * add changeset * notebooks script * changes * changes --------- Co-authored-by: Ali Abid <aliabid94@gmail.com> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
17 lines
450 B
Python
17 lines
450 B
Python
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.
|