From 064965c4660f57f24e2d51a9854defaeabf8c0cf Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Mon, 5 Sep 2022 19:37:11 +0300 Subject: added --listen option to make gradio listen on network requests --- modules/shared.py | 1 + modules/ui.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/shared.py b/modules/shared.py index 9e744f6c..70946fea 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -30,6 +30,7 @@ parser.add_argument("--precision", type=str, help="evaluate at this precision", parser.add_argument("--share", action='store_true', help="use share=True for gradio and make the UI accessible through their site (doesn't work for me but you might have better luck)") parser.add_argument("--esrgan-models-path", type=str, help="path to directory with ESRGAN models", default=os.path.join(script_path, 'ESRGAN')) parser.add_argument("--opt-split-attention", action='store_true', help="enable optimization that reduced vram usage by a lot for about 10% decrease in performance") +parser.add_argument("--listen", action='store_true', help="launch gradio with 0.0.0.0 as server name, allowing to respond to network requests") cmd_opts = parser.parse_args() cpu = torch.device("cpu") diff --git a/modules/ui.py b/modules/ui.py index 0d70529c..ec583d14 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -27,7 +27,7 @@ mimetypes.init() mimetypes.add_type('application/javascript', '.js') -if not cmd_opts.share: +if not cmd_opts.share and not cmd_opts.listen: # fix gradio phoning home gradio.utils.version_check = lambda: None gradio.utils.get_local_ip_address = lambda: '127.0.0.1' -- cgit v1.2.3