Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import gradio as gr
|
|
| 3 |
from fastapi import FastAPI
|
| 4 |
from gradio_client import Client
|
| 5 |
from typing import Union
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
app = FastAPI()
|
|
@@ -15,12 +16,14 @@ def DS_chatbot(message,history):
|
|
| 15 |
|
| 16 |
io = gr.ChatInterface(DS_chatbot, title=" DS Chatbot", description="Enter text to start chatting.")
|
| 17 |
@app.get("/")
|
| 18 |
-
def read_main():
|
| 19 |
return {"message": "Append /gradio to the url to see gradio the interface"}
|
| 20 |
|
| 21 |
@app.get("/hello/{name}")
|
| 22 |
-
def read_name(name: Union[str, None] = None):
|
| 23 |
return { "Hey!": name}
|
| 24 |
|
| 25 |
# Mount the Gradio app onto the FastAPI app
|
| 26 |
-
app = gr.mount_gradio_app(app, io, path='/gradio')
|
|
|
|
|
|
|
|
|
| 3 |
from fastapi import FastAPI
|
| 4 |
from gradio_client import Client
|
| 5 |
from typing import Union
|
| 6 |
+
import uvicorn
|
| 7 |
|
| 8 |
|
| 9 |
app = FastAPI()
|
|
|
|
| 16 |
|
| 17 |
io = gr.ChatInterface(DS_chatbot, title=" DS Chatbot", description="Enter text to start chatting.")
|
| 18 |
@app.get("/")
|
| 19 |
+
async def read_main():
|
| 20 |
return {"message": "Append /gradio to the url to see gradio the interface"}
|
| 21 |
|
| 22 |
@app.get("/hello/{name}")
|
| 23 |
+
async def read_name(name: Union[str, None] = None):
|
| 24 |
return { "Hey!": name}
|
| 25 |
|
| 26 |
# Mount the Gradio app onto the FastAPI app
|
| 27 |
+
app = gr.mount_gradio_app(app, io, path='/gradio')
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|