Spaces:
Sleeping
Sleeping
Gianpaolo Macario
commited on
Commit
·
155b533
1
Parent(s):
7390cf0
feat: add app2.py
Browse filesDebugging integration of Gradio and FastAPI.
See https://www.gradio.app/docs/gradio/mount_gradio_app
Signed-off-by: Gianpaolo Macario <[email protected]>
README.md
CHANGED
|
@@ -5,7 +5,7 @@ colorFrom: purple
|
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.34.2
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
| 10 |
base_path: /gradio
|
| 11 |
---
|
|
|
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.34.2
|
| 8 |
+
app_file: app2.py
|
| 9 |
pinned: false
|
| 10 |
base_path: /gradio
|
| 11 |
---
|
app2.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
import gradio as gr
|
| 3 |
+
app = FastAPI()
|
| 4 |
+
@app.get("/")
|
| 5 |
+
def read_main():
|
| 6 |
+
return {"message": "This is your main app"}
|
| 7 |
+
io = gr.Interface(lambda x: "Hello, " + x + "!", "textbox", "textbox")
|
| 8 |
+
app = gr.mount_gradio_app(app, io, path="/gradio")
|