Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,19 +6,21 @@ import uvicorn
|
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
|
|
|
|
9 |
|
10 |
block = gr.Blocks().queue()
|
11 |
with block:
|
12 |
prompt = gr.Text()
|
13 |
output = gr.Text()
|
14 |
|
15 |
-
|
16 |
btn = gr.Button("Generate")
|
17 |
-
btn.click(
|
18 |
|
19 |
gradio_app = gr.routes.App.create_app(block)
|
20 |
|
21 |
-
app = gr.mount_gradio_app(app, gradio_app, "
|
|
|
22 |
app.mount("/static", StaticFiles(directory="static", html=True), name="static")
|
23 |
|
24 |
uvicorn.run(app, host='0.0.0.0', port=7860)
|
|
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
9 |
+
def predict(a):
|
10 |
+
return a
|
11 |
|
12 |
block = gr.Blocks().queue()
|
13 |
with block:
|
14 |
prompt = gr.Text()
|
15 |
output = gr.Text()
|
16 |
|
|
|
17 |
btn = gr.Button("Generate")
|
18 |
+
btn.click(predict, inputs=[prompt], outputs=[output])
|
19 |
|
20 |
gradio_app = gr.routes.App.create_app(block)
|
21 |
|
22 |
+
app = gr.mount_gradio_app(app, gradio_app, "/",
|
23 |
+
gradio_api_url="http://localhost:7860/")
|
24 |
app.mount("/static", StaticFiles(directory="static", html=True), name="static")
|
25 |
|
26 |
uvicorn.run(app, host='0.0.0.0', port=7860)
|