added --listen option to make gradio listen on network requests
This commit is contained in:
parent
5bb69bd915
commit
064965c466
3 changed files with 3 additions and 2 deletions
|
@ -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")
|
||||
|
|
|
@ -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'
|
||||
|
|
2
webui.py
2
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)
|
||||
|
|
Loading…
Reference in a new issue