aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-05 19:37:11 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-05 19:37:11 +0300
commit064965c4660f57f24e2d51a9854defaeabf8c0cf (patch)
treea4f1a1cbe2a301ec3dde5d1231d7e1e124bbda70 /modules
parent5bb69bd915ff16fe233f887dba8c9ae8502d08d9 (diff)
added --listen option to make gradio listen on network requests
Diffstat (limited to 'modules')
-rw-r--r--modules/shared.py1
-rw-r--r--modules/ui.py2
2 files changed, 2 insertions, 1 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'