File size: 519 Bytes
f77b4c6
 
 
 
 
 
 
 
 
 
 
 
d33d3f5
9d3d9eb
f77b4c6
9d3d9eb
f77b4c6
0b40cdf
9d3d9eb
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
import uvicorn


app = FastAPI()


block = gr.Blocks().queue()
with block:
    prompt = gr.Text()
    output = gr.Text()
    
    btn = gr.Button("Generate")
    btn.click(lambda x:x, inputs=[prompt], outputs=[output])

app.mount("/static", StaticFiles(directory="static", html=True), name="static")
app = gr.mount_gradio_app(app, block, "/", gradio_api_url="http://localhost:7860/")
uvicorn.run(app, host="0.0.0.0", port=7860)