diff --git a/README.md b/README.md index 4756672e..218fa765 100644 --- a/README.md +++ b/README.md @@ -317,6 +317,8 @@ Optionally, you can use the following command-line flags: | `--auto-launch` | Open the web UI in the default browser upon launch. | | `--gradio-auth USER:PWD` | set gradio authentication like "username:password"; or comma-delimit multiple like "u1:p1,u2:p2,u3:p3" | | `--gradio-auth-path GRADIO_AUTH_PATH` | Set the gradio authentication file path. The file should contain one or more user:password pairs in this format: "u1:p1,u2:p2,u3:p3" | +| `--ssl-keyfile SSL_KEYFILE` | The path to the SSL certificate key file. | +| `--ssl-certfile SSL_CERTFILE` | The path to the SSL certificate cert file. | #### API diff --git a/modules/shared.py b/modules/shared.py index fc9ba3cf..51017a1b 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -180,6 +180,8 @@ parser.add_argument('--share', action='store_true', help='Create a public URL. T parser.add_argument('--auto-launch', action='store_true', default=False, help='Open the web UI in the default browser upon launch.') parser.add_argument("--gradio-auth", type=str, help='set gradio authentication like "username:password"; or comma-delimit multiple like "u1:p1,u2:p2,u3:p3"', default=None) parser.add_argument("--gradio-auth-path", type=str, help='Set the gradio authentication file path. The file should contain one or more user:password pairs in this format: "u1:p1,u2:p2,u3:p3"', default=None) +parser.add_argument("--ssl-keyfile", type=str, help='The path to the SSL certificate key file.', default=None) +parser.add_argument("--ssl-certfile", type=str, help='The path to the SSL certificate cert file.', default=None) # API parser.add_argument('--api', action='store_true', help='Enable the API extension.') diff --git a/server.py b/server.py index d1a23bbe..0e1d199d 100644 --- a/server.py +++ b/server.py @@ -1081,11 +1081,17 @@ def create_interface(): # Launch the interface shared.gradio['interface'].queue() with OpenMonkeyPatch(): - if shared.args.listen: - shared.gradio['interface'].launch(prevent_thread_lock=True, share=shared.args.share, server_name=shared.args.listen_host or '0.0.0.0', server_port=shared.args.listen_port, inbrowser=shared.args.auto_launch, auth=auth) - else: - shared.gradio['interface'].launch(prevent_thread_lock=True, share=shared.args.share, server_port=shared.args.listen_port, inbrowser=shared.args.auto_launch, auth=auth) - + shared.gradio['interface'].launch( + prevent_thread_lock=True, + share=shared.args.share, + server_name = None if not shared.args.listen else (shared.args.listen_host or '0.0.0.0'), + server_port=shared.args.listen_port, + inbrowser=shared.args.auto_launch, + auth=auth, + ssl_verify=False if (shared.args.ssl_keyfile or shared.args.ssl_certfile) else True, + ssl_keyfile=shared.args.ssl_keyfile, + ssl_certfile=shared.args.ssl_certfile + ) if __name__ == "__main__": # Loading custom settings