Dvirmor100 commited on
Commit
b35b509
·
1 Parent(s): 10a54af

feat(gradio): create sample gradio serving with fastapi

Browse files
Files changed (2) hide show
  1. requirements.txt +2 -1
  2. src/app.py +7 -3
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  fastapi
2
- uvicorn[standard]
 
 
1
  fastapi
2
+ uvicorn[standard]
3
+ gradio
src/app.py CHANGED
@@ -1,7 +1,11 @@
1
  from fastapi import FastAPI
 
2
 
3
  app = FastAPI()
4
 
5
- @app.get("/")
6
- def greet_json():
7
- return {"Hello": "World!"}
 
 
 
 
1
  from fastapi import FastAPI
2
+ import gradio as gr
3
 
4
  app = FastAPI()
5
 
6
+ def greet(name):
7
+ return f"Hello {name}!"
8
+
9
+ iface = gr.Interface(fn=greet, inputs="text", outputs="text")
10
+
11
+ app.mount("/gradio", iface)