File size: 574 Bytes
def8982
 
 
 
 
 
 
 
 
 
 
 
 
7db2ce9
def8982
 
 
 
7db2ce9
def8982
7db2ce9
def8982
 
2406b79
d978202
857a1da
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
import gradio as gr
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
import uvicorn


app = FastAPI()

@app.on_event("startup")
def print_foo():
    print("FOO!!!")

def dream(prompt):
    return "hello world!"

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


app = gr.mount_gradio_app(app, block, "/")
app.mount("/img", StaticFiles(directory="images", html=True), name="images")
uvicorn.run(app, host="0.0.0.0", port=7860)