File size: 695 Bytes
f50dd2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from fastapi import FastAPI
import gradio as gr

app = FastAPI()

@app.get("/health")
def read_main():
    return {"message": "All good"}


@app.get("/metrics")
def read_main():
    return {"score": "0.9"}

def greet(name):
    return "Hello " + name + " !!"

demo = gr.Interface(fn=greet, 
                    inputs="text", 
                    outputs="text",
                    title = "Sample app",
                    description="app is built via Dockero",
                    allow_flagging = "never"
                    )

app = gr.mount_gradio_app(app, demo, path="/")

import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8001)


#demo.launch(server_name="0.0.0.0", server_port=8001)