diff --git a/README.md b/README.md index 4a0fc1e..73e2102 100644 --- a/README.md +++ b/README.md @@ -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): diff --git a/kohya_gui.py b/kohya_gui.py index cb99ce1..a0b8222 100644 --- a/kohya_gui.py +++ b/kohya_gui.py @@ -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, )