Upgrade Gradio, remove docs URL hack

This commit is contained in:
Aarni Koskela 2023-05-22 09:53:24 +03:00
parent 1f3182924b
commit 47b669bc9f
3 changed files with 6 additions and 13 deletions

View File

@ -3,7 +3,7 @@ blendmodes
accelerate accelerate
basicsr basicsr
gfpgan gfpgan
gradio==3.31.0 gradio==3.32.0
numpy numpy
omegaconf omegaconf
opencv-contrib-python opencv-contrib-python

View File

@ -3,7 +3,7 @@ transformers==4.25.1
accelerate==0.18.0 accelerate==0.18.0
basicsr==1.4.2 basicsr==1.4.2
gfpgan==1.3.8 gfpgan==1.3.8
gradio==3.31.0 gradio==3.32.0
numpy==1.23.5 numpy==1.23.5
Pillow==9.5.0 Pillow==9.5.0
realesrgan==0.3.0 realesrgan==0.3.0

View File

@ -370,17 +370,6 @@ def webui():
gradio_auth_creds = list(get_gradio_auth_creds()) or None gradio_auth_creds = list(get_gradio_auth_creds()) or None
# this restores the missing /docs endpoint
if launch_api and not hasattr(FastAPI, 'original_setup'):
# TODO: replace this with `launch(app_kwargs=...)` if https://github.com/gradio-app/gradio/pull/4282 gets merged
def fastapi_setup(self):
self.docs_url = "/docs"
self.redoc_url = "/redoc"
self.original_setup()
FastAPI.original_setup = FastAPI.setup
FastAPI.setup = fastapi_setup
app, local_url, share_url = shared.demo.launch( app, local_url, share_url = shared.demo.launch(
share=cmd_opts.share, share=cmd_opts.share,
server_name=server_name, server_name=server_name,
@ -393,6 +382,10 @@ def webui():
inbrowser=cmd_opts.autolaunch, inbrowser=cmd_opts.autolaunch,
prevent_thread_lock=True, prevent_thread_lock=True,
allowed_paths=cmd_opts.gradio_allowed_path, allowed_paths=cmd_opts.gradio_allowed_path,
app_kwargs={
"docs_url": "/docs",
"redoc_url": "/redoc",
},
) )
if cmd_opts.add_stop_route: if cmd_opts.add_stop_route:
app.add_route("/_stop", stop_route, methods=["POST"]) app.add_route("/_stop", stop_route, methods=["POST"])