Merge pull request #30 from 10sa/patch-1

Add listening port options for listening mode.
This commit is contained in:
oobabooga 2023-01-28 20:35:20 -03:00 committed by GitHub
commit f4c455ce29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,7 @@ parser.add_argument('--no-stream', action='store_true', help='Don\'t stream the
parser.add_argument('--settings', type=str, help='Load the default interface settings from this json file. See settings-template.json for an example.') parser.add_argument('--settings', type=str, help='Load the default interface settings from this json file. See settings-template.json for an example.')
parser.add_argument('--extensions', type=str, help='The list of extensions to load. If you want to load more than one extension, write the names separated by commas and between quotation marks, "like,this".') parser.add_argument('--extensions', type=str, help='The list of extensions to load. If you want to load more than one extension, write the names separated by commas and between quotation marks, "like,this".')
parser.add_argument('--listen', action='store_true', help='Make the web UI reachable from your local network.') parser.add_argument('--listen', action='store_true', help='Make the web UI reachable from your local network.')
parser.add_argument('--listen-port', type=int, choices=range(0, 65535), help='The listening port the server will use.')
parser.add_argument('--share', action='store_true', help='Create a public URL. This is useful for running the web UI on Google Colab or similar.') parser.add_argument('--share', action='store_true', help='Create a public URL. This is useful for running the web UI on Google Colab or similar.')
parser.add_argument('--verbose', action='store_true', help='Print the prompts to the terminal.') parser.add_argument('--verbose', action='store_true', help='Print the prompts to the terminal.')
args = parser.parse_args() args = parser.parse_args()
@ -693,6 +694,6 @@ else:
interface.queue() interface.queue()
if args.listen: if args.listen:
interface.launch(share=args.share, server_name="0.0.0.0") interface.launch(share=args.share, server_name="0.0.0.0", server_port=args.listen_port)
else: else:
interface.launch(share=args.share) interface.launch(share=args.share, server_port=args.listen_port)