aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/shared.py1
-rw-r--r--modules/ui.py2
-rw-r--r--webui.py2
3 files changed, 3 insertions, 2 deletions
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'
diff --git a/webui.py b/webui.py
index dbc9dd54..8eebeeee 100644
--- a/webui.py
+++ b/webui.py
@@ -169,4 +169,4 @@ demo = modules.ui.create_ui(
run_pnginfo=run_pnginfo
)
-demo.launch(share=cmd_opts.share)
+demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None)