diff --git a/gradio/interface.py b/gradio/interface.py index fafcc1076b..1e508d60bf 100644 --- a/gradio/interface.py +++ b/gradio/interface.py @@ -629,6 +629,7 @@ class Interface: favicon_path: Optional[str] = None, ssl_keyfile: Optional[str] = None, ssl_certfile: Optional[str] = None, + ssl_keyfile_password: Optional[str] = None, ) -> Tuple[flask.Flask, str, str]: """ Launches the webserver that serves the UI for the interface. @@ -653,6 +654,7 @@ class Interface: favicon_path (str): If a path to a file (.png, .gif, or .ico) is provided, it will be used as the favicon for the web page. ssl_keyfile (str): If a path to a file is provided, will use this as the private key file to create a local server running on https. ssl_certfile (str): If a path to a file is provided, will use this as the signed certificate for https. Needs to be provided if ssl_keyfile is provided. + ssl_keyfile_password (str): If a password is provided, will use this with the ssl certificate for https. Returns: app (flask.Flask): Flask app object path_to_local_server (str): Locally accessible link @@ -694,7 +696,8 @@ class Interface: cache_interface_examples(self) server_port, path_to_local_server, app, server = networking.start_server( - self, server_name, server_port, ssl_keyfile, ssl_certfile + self, server_name, server_port, ssl_keyfile, ssl_certfile, + ssl_keyfile_password ) self.local_url = path_to_local_server diff --git a/gradio/networking.py b/gradio/networking.py index cb3a92d5ce..22bdefde4c 100644 --- a/gradio/networking.py +++ b/gradio/networking.py @@ -76,6 +76,7 @@ def start_server( server_port: Optional[int] = None, ssl_keyfile: Optional[str] = None, ssl_certfile: Optional[str] = None, + ssl_keyfile_password: Optional[str] = None, ) -> Tuple[int, str, fastapi.FastAPI, threading.Thread, None]: """Launches a local server running the provided Interface Parameters: @@ -85,6 +86,7 @@ def start_server( auth: If provided, username and password (or list of username-password tuples) required to access interface. Can also provide function that takes username and password and returns True if valid login. ssl_keyfile: If a path to a file is provided, will use this as the private key file to create a local server running on https. ssl_certfile: If a path to a file is provided, will use this as the signed certificate for https. Needs to be provided if ssl_keyfile is provided. + ssl_keyfile_password (str): If a password is provided, will use this with the ssl certificate for https. """ server_name = server_name or LOCALHOST_NAME # if port is not specified, search for first available port @@ -147,6 +149,7 @@ def start_server( log_level="warning", ssl_keyfile=ssl_keyfile, ssl_certfile=ssl_certfile, + ssl_keyfile_password=ssl_keyfile_password, ) server = Server(config=config) server.run_in_thread()