mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
Add "ssl_verify" param to allow use of self-signed certs (#3873)
* Add "ssl_verify" param to allow use of self-signed certs * Update changelog * Add ssl_verify to queue.start() * lint * type check * fix tests --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
parent
df7d645207
commit
73ec7fb0a8
@ -148,6 +148,7 @@ with gr.Blocks() as demo:
|
||||
- Fix bug where http token was not accessed over websocket connections by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3735](https://github.com/gradio-app/gradio/pull/3735)
|
||||
- Add ability to specify `rows`, `columns` and `object-fit` in `style()` for `gr.Gallery()` component by [@dawoodkhan82](https://github.com/dawoodkhan82) in [PR 3586](https://github.com/gradio-app/gradio/pull/3586)
|
||||
- Fix bug where recording an audio file through the microphone resulted in a corrupted file name by [@abidlabs](https://github.com/abidlabs) in [PR 3770](https://github.com/gradio-app/gradio/pull/3770)
|
||||
- Added "ssl_verify" to blocks.launch method to allow for use of self-signed certs by [@garrettsutula](https://github.com/garrettsutula) in [PR 3873](https://github.com/gradio-app/gradio/pull/3873)
|
||||
- Fix bug where iterators where not being reset for processes that terminated early by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3777](https://github.com/gradio-app/gradio/pull/3777)
|
||||
- Fix bug where the upload button was not properly handling the `file_count='multiple'` case by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3782](https://github.com/gradio-app/gradio/pull/3782)
|
||||
- Fix bug where use Via API button was giving error by [@Devang-C](https://github.com/Devang-C) in [PR 3783](https://github.com/gradio-app/gradio/pull/3783)
|
||||
|
@ -692,6 +692,7 @@ class Blocks(BlockContext):
|
||||
self.__name__ = None
|
||||
self.api_mode = None
|
||||
self.progress_tracking = None
|
||||
self.ssl_verify = True
|
||||
|
||||
self.file_directories = []
|
||||
|
||||
@ -1588,6 +1589,7 @@ Received outputs:
|
||||
ssl_keyfile: str | None = None,
|
||||
ssl_certfile: str | None = None,
|
||||
ssl_keyfile_password: str | None = None,
|
||||
ssl_verify: bool = True,
|
||||
quiet: bool = False,
|
||||
show_api: bool = True,
|
||||
file_directories: List[str] | None = None,
|
||||
@ -1618,6 +1620,7 @@ Received outputs:
|
||||
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: If a password is provided, will use this with the ssl certificate for https.
|
||||
ssl_verify: If False, skips certificate validation which allows self-signed certificates to be used.
|
||||
quiet: If True, suppresses most print statements.
|
||||
show_api: If True, shows the api docs in the footer of the app. Default True. If the queue is enabled, then api_open parameter of .queue() will determine if the api docs are shown, independent of the value of show_api.
|
||||
file_directories: List of directories that gradio is allowed to serve files from (in addition to the directory containing the gradio python file). Must be absolute paths. Warning: any files in these directories or its children are potentially accessible to all users of your app.
|
||||
@ -1659,6 +1662,7 @@ Received outputs:
|
||||
self.height = height
|
||||
self.width = width
|
||||
self.favicon_path = favicon_path
|
||||
self.ssl_verify = ssl_verify
|
||||
|
||||
if enable_queue is not None:
|
||||
self.enable_queue = enable_queue
|
||||
@ -1729,7 +1733,7 @@ Received outputs:
|
||||
|
||||
# Cannot run async functions in background other than app's scope.
|
||||
# Workaround by triggering the app endpoint
|
||||
requests.get(f"{self.local_url}startup-events")
|
||||
requests.get(f"{self.local_url}startup-events", verify=ssl_verify)
|
||||
|
||||
utils.launch_counter()
|
||||
|
||||
@ -2017,7 +2021,9 @@ Received outputs:
|
||||
"""Events that should be run when the app containing this block starts up."""
|
||||
|
||||
if self.enable_queue:
|
||||
utils.run_coro_in_background(self._queue.start, (self.progress_tracking,))
|
||||
utils.run_coro_in_background(
|
||||
self._queue.start, self.progress_tracking, self.ssl_verify
|
||||
)
|
||||
# So that processing can resume in case the queue was stopped
|
||||
self._queue.stopped = False
|
||||
utils.run_coro_in_background(self.create_limiter)
|
||||
|
@ -67,9 +67,9 @@ class Queue:
|
||||
self.access_token = ""
|
||||
self.queue_client = None
|
||||
|
||||
async def start(self, progress_tracking=False):
|
||||
async def start(self, progress_tracking=False, ssl_verify=True):
|
||||
# So that the client is attached to the running event loop
|
||||
self.queue_client = httpx.AsyncClient()
|
||||
self.queue_client = httpx.AsyncClient(verify=ssl_verify)
|
||||
|
||||
run_coro_in_background(self.start_processing)
|
||||
if progress_tracking:
|
||||
|
Loading…
Reference in New Issue
Block a user