Add --listen support

This commit is contained in:
bmaltais 2023-03-05 21:57:06 -05:00
parent 9e6b4cb69b
commit 414a98d100
2 changed files with 9 additions and 1 deletions

View File

@ -178,7 +178,8 @@ This will store your a backup file with your current locally installed pip packa
* 2023/03/05 (v21.1.5):
- Add replace underscore with space option to WD14 captioning. Thanks @sALTaccount!
- Improve how custom preset is set and handles. Still not perfect but better.
- Improve how custom preset is set and handles.
- Add support for `--listen` argument. This allow gradio to listen for connections from other devices on the network (or internet). For example: `gui.ps1 --listen "0.0.0.0"` will allow anyone to connect to the gradio webui.
* 2023/03/05 (v21.1.4):
- Removing legacy and confusing use 8bit adam chackbox. It is now configured using the Optimiser drop down list. It will be set properly based on legacy config files.
* 2023/03/04 (v21.1.3):

View File

@ -52,6 +52,9 @@ def UI(**kwargs):
server_port = kwargs.get('server_port', 0)
inbrowser = kwargs.get('inbrowser', False)
share = kwargs.get('share', False)
server_name = kwargs.get('listen')
launch_kwargs['server_name'] = server_name
if username and password:
launch_kwargs['auth'] = (username, password)
if server_port > 0:
@ -66,6 +69,9 @@ def UI(**kwargs):
if __name__ == '__main__':
# torch.cuda.set_per_process_memory_fraction(0.48)
parser = argparse.ArgumentParser()
parser.add_argument(
'--listen', type=str, default='127.0.0.1', help='IP to listen on for connections to Gradio'
)
parser.add_argument(
'--username', type=str, default='', help='Username for authentication'
)
@ -93,4 +99,5 @@ if __name__ == '__main__':
inbrowser=args.inbrowser,
server_port=args.server_port,
share=args.share,
listen=args.listen,
)