From 5d087731a53da265e20dfd10b172c6104faf55f1 Mon Sep 17 00:00:00 2001 From: orionaskatu <100234619+orionaskatu@users.noreply.github.com> Date: Thu, 8 Sep 2022 09:44:14 +0200 Subject: [PATCH 1/8] add --port argument to shared.py defaults to 7860 --- modules/shared.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/shared.py b/modules/shared.py index e529ec27..b65c9616 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -34,6 +34,7 @@ parser.add_argument("--share", action='store_true', help="use share=True for gra 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") +parser.add_argument("--port", type=int, help="launch gradio with given server port", default=7860) cmd_opts = parser.parse_args() if torch.has_cuda: From 4f3cebd51d18256aff3c8b6af3cfc21d793e89ee Mon Sep 17 00:00:00 2001 From: orionaskatu <100234619+orionaskatu@users.noreply.github.com> Date: Thu, 8 Sep 2022 09:46:28 +0200 Subject: [PATCH 2/8] Add server_port param to webui.py --- webui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui.py b/webui.py index 4f701fad..74c870a2 100644 --- a/webui.py +++ b/webui.py @@ -191,4 +191,4 @@ if __name__ == "__main__": run_pnginfo=run_pnginfo ) - demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None) + demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None, server_port=cmd_opts.port) From db92896e30d61df7d2bf62033150184e76b664de Mon Sep 17 00:00:00 2001 From: orionaskatu <100234619+orionaskatu@users.noreply.github.com> Date: Thu, 8 Sep 2022 09:47:56 +0200 Subject: [PATCH 3/8] help message for ports < 1024 --- modules/shared.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/shared.py b/modules/shared.py index b65c9616..1882cf34 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -34,7 +34,7 @@ parser.add_argument("--share", action='store_true', help="use share=True for gra 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") -parser.add_argument("--port", type=int, help="launch gradio with given server port", default=7860) +parser.add_argument("--port", type=int, help="launch gradio with given server port, you need root/admin rights for ports < 1024", default=7860) cmd_opts = parser.parse_args() if torch.has_cuda: From 9c510011ace92897633b01722594ce35ffac8302 Mon Sep 17 00:00:00 2001 From: orionaskatu <100234619+orionaskatu@users.noreply.github.com> Date: Thu, 8 Sep 2022 09:51:33 +0200 Subject: [PATCH 4/8] update readme for --port option --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b975db15..7df7a92c 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,9 @@ program in collabs. Use `--listen` to make the server listen to network connections. This will allow computers on local newtork to access the UI, and if you configure port forwarding, also computers on the internet. +Use `--port xxxx` to make the server listen on a specific port, xxxx being the wanted port. Remember that +all ports below 1024 needs root/admin rights, for this reason it is advised to use a port above 1024. + ### Textual Inversion To make use of pretrained embeddings, create `embeddings` directory (in the same palce as `webui.py`) and put your embeddings into it. They must be .pt files, each with only one trained embedding, From 48317a5176466b0de8be06a7af30d3d2a437de49 Mon Sep 17 00:00:00 2001 From: orionaskatu <100234619+orionaskatu@users.noreply.github.com> Date: Thu, 8 Sep 2022 10:40:56 +0200 Subject: [PATCH 5/8] Port defaults to none --- webui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui.py b/webui.py index 74c870a2..b65b534b 100644 --- a/webui.py +++ b/webui.py @@ -191,4 +191,4 @@ if __name__ == "__main__": run_pnginfo=run_pnginfo ) - demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None, server_port=cmd_opts.port) + demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None, server_port=cmd_opts.port if cmd_opts.port else None) From 567c1fbc1c0be1a922ba8aee6ec20c99fa5bf363 Mon Sep 17 00:00:00 2001 From: orionaskatu <100234619+orionaskatu@users.noreply.github.com> Date: Thu, 8 Sep 2022 10:42:21 +0200 Subject: [PATCH 6/8] Port defaults to none --- modules/shared.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/shared.py b/modules/shared.py index 1882cf34..de7cbf02 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -34,7 +34,7 @@ parser.add_argument("--share", action='store_true', help="use share=True for gra 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") -parser.add_argument("--port", type=int, help="launch gradio with given server port, you need root/admin rights for ports < 1024", default=7860) +parser.add_argument("--port", type=int, help="launch gradio with given server port, you need root/admin rights for ports < 1024, defaults to 7860 if available", default=None) cmd_opts = parser.parse_args() if torch.has_cuda: From 50178b7f5b959e1aac7b39e0ffe2f9393029a112 Mon Sep 17 00:00:00 2001 From: orionaskatu <100234619+orionaskatu@users.noreply.github.com> Date: Thu, 8 Sep 2022 10:43:12 +0200 Subject: [PATCH 7/8] Port defaults to 7860 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7df7a92c..a82fae3f 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ to access the UI, and if you configure port forwarding, also computers on the in Use `--port xxxx` to make the server listen on a specific port, xxxx being the wanted port. Remember that all ports below 1024 needs root/admin rights, for this reason it is advised to use a port above 1024. +Defaults to port 7860 if available. ### Textual Inversion To make use of pretrained embeddings, create `embeddings` directory (in the same palce as `webui.py`) From cce6f1df4117dc90cb16a07dc1634f0203c6bc0d Mon Sep 17 00:00:00 2001 From: orionaskatu <100234619+orionaskatu@users.noreply.github.com> Date: Thu, 8 Sep 2022 10:46:23 +0200 Subject: [PATCH 8/8] fix default --- webui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui.py b/webui.py index b65b534b..74c870a2 100644 --- a/webui.py +++ b/webui.py @@ -191,4 +191,4 @@ if __name__ == "__main__": run_pnginfo=run_pnginfo ) - demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None, server_port=cmd_opts.port if cmd_opts.port else None) + demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None, server_port=cmd_opts.port)