From b2f6e0704e178f64881f507f3a48ff36e63e1a62 Mon Sep 17 00:00:00 2001 From: catalpaaa Date: Tue, 25 Apr 2023 07:27:24 -0700 Subject: [PATCH 1/2] add subpath support --- modules/cmd_args.py | 1 + webui.py | 5 +++++ webui.sh | 0 3 files changed, 6 insertions(+) mode change 100755 => 100644 webui.sh diff --git a/modules/cmd_args.py b/modules/cmd_args.py index 81c0b82a..bdf106bf 100644 --- a/modules/cmd_args.py +++ b/modules/cmd_args.py @@ -101,3 +101,4 @@ parser.add_argument("--no-gradio-queue", action='store_true', help="Disables gra parser.add_argument("--skip-version-check", action='store_true', help="Do not check versions of torch and xformers") parser.add_argument("--no-hashing", action='store_true', help="disable sha256 hashing of checkpoints to help loading performance", default=False) parser.add_argument("--no-download-sd-model", action='store_true', help="don't download SD1.5 model even if no model is found in --ckpt-dir", default=False) +parser.add_argument('--subpath', type=str, help='customize the subpath for gradio, use with reverse proxy') \ No newline at end of file diff --git a/webui.py b/webui.py index b570895f..d8997819 100644 --- a/webui.py +++ b/webui.py @@ -290,6 +290,11 @@ def webui(): print(f"Startup time: {startup_timer.summary()}.") + if cmd_opts.subpath: + redirector = FastAPI() + redirector.get("/") + mounted_app = gradio.mount_gradio_app(redirector, shared.demo, path=f"/{cmd_opts.subpath}") + wait_on_server(shared.demo) print('Restarting UI...') diff --git a/webui.sh b/webui.sh old mode 100755 new mode 100644 From ecdc6471e7d694ef9ecec96e8c3128237efe069a Mon Sep 17 00:00:00 2001 From: catalpaaa Date: Fri, 28 Apr 2023 12:23:53 -0700 Subject: [PATCH 2/2] bump gradio to 3.28 --- requirements.txt | 2 +- requirements_versions.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index c72b2927..21337522 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ basicsr fonts font-roboto gfpgan -gradio==3.23 +gradio==3.28 invisible-watermark numpy omegaconf diff --git a/requirements_versions.txt b/requirements_versions.txt index df65431a..0fe01801 100644 --- a/requirements_versions.txt +++ b/requirements_versions.txt @@ -3,7 +3,7 @@ transformers==4.25.1 accelerate==0.12.0 basicsr==1.4.2 gfpgan==1.3.8 -gradio==3.23 +gradio==3.28 numpy==1.23.3 Pillow==9.4.0 realesrgan==0.3.0