Merge pull request #446 from ykk648/master

add LAN support
This commit is contained in:
bmaltais 2023-03-25 12:45:45 -04:00 committed by GitHub
commit 0e25977a09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1103,6 +1103,8 @@ def UI(**kwargs):
launch_kwargs['server_port'] = kwargs.get('server_port', 0)
if kwargs.get('inbrowser', False):
launch_kwargs['inbrowser'] = kwargs.get('inbrowser', False)
if kwargs.get('listen', True):
launch_kwargs['server_name'] = "0.0.0.0"
print(launch_kwargs)
interface.launch(**launch_kwargs)
@ -1125,6 +1127,9 @@ if __name__ == '__main__':
parser.add_argument(
'--inbrowser', action='store_true', help='Open in browser'
)
parser.add_argument(
'--listen', action='store_true', help='Launch gradio with server name 0.0.0.0, allowing LAN access'
)
args = parser.parse_args()