freddyaboulton HF staff commited on
Commit
6a8cd43
1 Parent(s): db7af4f

Use latest

Browse files
Files changed (2) hide show
  1. app.py +1 -23
  2. requirements.txt +1 -1
app.py CHANGED
@@ -21,28 +21,6 @@ with block:
21
  btn.click(dream, inputs=prompt, outputs=[gallery])
22
 
23
 
24
- def mount_gradio_app(
25
- app: FastAPI, blocks: gr.Blocks, path: str, gradio_api: str
26
- ) -> FastAPI:
27
- """Mount a gradio application (created with gr.routes.App.create_app(block)) to an existing FastAPI application.
28
-
29
- Parameters:
30
- app: The parent FastAPI application.
31
- blocks: The blocks application we want to moung
32
- path: The path at which the gradio application will be mounted.
33
- """
34
-
35
- gradio_app = gr.routes.App.create_app(blocks)
36
-
37
- @app.on_event("startup")
38
- async def start_queue():
39
- if gradio_app.blocks.enable_queue:
40
- gradio_app.blocks._queue.set_url(gradio_api)
41
- gradio_app.blocks.startup_events()
42
-
43
- app.mount(path, gradio_app)
44
- return app
45
-
46
- app = mount_gradio_app(app, block, "/", gradio_api="http://localhost:7860/")
47
  app.mount("/img", StaticFiles(directory="images", html=True), name="images")
48
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
21
  btn.click(dream, inputs=prompt, outputs=[gallery])
22
 
23
 
24
+ app = gr.mount_gradio_app(app, block, "/", gradio_api_url="http://localhost:7860/")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  app.mount("/img", StaticFiles(directory="images", html=True), name="images")
26
  uvicorn.run(app, host="0.0.0.0", port=7860)
requirements.txt CHANGED
@@ -1 +1 @@
1
- https://gradio-builds.s3.amazonaws.com/7937027da4c92a062de25f97678a5e4c83e9bb3f/gradio-3.3.1-py3-none-any.whl
 
1
+ https://gradio-builds.s3.amazonaws.com/20aaffed4b31b59a500320d619c12154628d0492/gradio-3.3.1-py3-none-any.whl