mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-15 02:11:15 +08:00
9f7dd05b72
* First stab at it
* Use util methos
* lint
* Test
* Fix formatting
* Try out setting predict endpoint from websocket request
* lint
* Fix bug
* Address comments - remove server and port
* Skip in 3.7
* Fix documentation
* Add default 🤦
* docs tweak
* Add back imports that were deleted by wrong linter version
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
20 lines
453 B
Python
20 lines
453 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.
|