d3dname commited on
Commit
2322418
·
verified ·
1 Parent(s): a72021e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import gradio as gr
3
+
4
+ app = FastAPI()
5
+
6
+ def echo(message):
7
+ return message
8
+
9
+ demo = gr.Interface(
10
+ fn=echo,
11
+ inputs="text",
12
+ outputs="text",
13
+ title="Echo App",
14
+ description="Enter some text, and I'll echo it back to you!"
15
+ )
16
+
17
+ app = gr.mount_gradio_app(app, demo, path="/")
18
+
19
+ @app.get("/hello")
20
+ def hello_world():
21
+ return {"message": "Hello, World!"}
22
+
23
+ if __name__ == "__main__":
24
+ import uvicorn
25
+ uvicorn.run(app, host="0.0.0.0", port=8000)