I have gradio asr server with gradio 4.31.0. And I use self assigned certificate.
Then I use gradio_client to call this sever. When I use gradio 4.31.0(which contains gradio_client 0.16.2), it throws CERTIFICATE_VERIFY_FAILED. But if I downgrade gradio to 4.28.3(which contains gradio_client 0.16.0), it's ok.
Have you searched existing issues? 🔎
[X] I have searched and found no existing issues
Reproduction
asr server(4.31.0)
from transformers import pipeline
import torch
model_id = "openai/whisper-large-v3" # update with your model id
res = client.predict(
filepath=file("en.wav"),
api_name="/predict"
)
print(res)
### Screenshot
_No response_
### Logs
If I ran client with gradio 4.31.0(which contains gradio_client 0.16.2). it throws exception:
Loaded as API: https://192.168.0.10:7860/ ✔
Traceback (most recent call last):
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
yield
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 233, in handle_request
resp = self._pool.handle_request(req)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request
raise exc from None
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 196, in handle_request
response = connection.handle_request(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 99, in handle_request
raise exc
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 76, in handle_request
stream = self._connect(request)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 154, in _connect
stream = stream.start_tls(**kwargs)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 152, in start_tls
with map_exceptions(exc_map):
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/media/lili/mydisk/codes/chatdemo/src/chatdemo/asr_client.py", line 6, in
res = client.predict(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 468, in predict
).result()
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 1480, in result
return super().result(timeout=timeout)
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 445, in result
return self.get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 390, in get_result
raise self._exception
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, *self.kwargs)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 1108, in _inner
predictions = _predict(data)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 1208, in _predict
event_id = self.client.send_data(data, hash_data, self.protocol)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 287, in send_data
req = httpx.post(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_api.py", line 319, in post
return request(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_api.py", line 106, in request
return client.request(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 827, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 914, in send
response = self._send_handling_auth(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 942, in _send_handling_auth
response = self._send_handling_redirects(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 979, in _send_handling_redirects
response = self._send_single_request(request)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 1015, in _send_single_request
response = transport.handle_request(request)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 232, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)
### System Info
client
```shell
Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 4.31.0
gradio_client version: 0.16.2
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.111.0
ffmpy: 0.3.2
gradio-client==0.16.2 is not installed.
httpx: 0.27.0
huggingface-hub: 0.23.0
importlib-resources: 6.4.0
jinja2: 3.1.4
markupsafe: 2.1.5
matplotlib: 3.8.4
numpy: 1.26.4
orjson: 3.10.3
packaging: 24.0
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.1
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.4
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.11.0
urllib3: 2.2.1
uvicorn: 0.29.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.
gradio_client dependencies in your environment:
fsspec: 2024.3.1
httpx: 0.27.0
huggingface-hub: 0.23.0
packaging: 24.0
typing-extensions: 4.11.0
websockets: 11.0.3
server:
Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 4.31.0
gradio_client version: 0.16.2
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.110.2
ffmpy: 0.3.2
gradio-client==0.16.2 is not installed.
httpx: 0.27.0
huggingface-hub: 0.22.2
importlib-resources: 6.4.0
jinja2: 3.1.3
markupsafe: 2.1.5
matplotlib: 3.8.4
numpy: 1.26.4
orjson: 3.10.1
packaging: 24.0
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.1
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.2
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.11.0
urllib3: 2.2.1
uvicorn: 0.29.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.
gradio_client dependencies in your environment:
fsspec: 2024.3.1
httpx: 0.27.0
huggingface-hub: 0.22.2
packaging: 24.0
typing-extensions: 4.11.0
websockets: 11.0.3
Describe the bug
I have gradio asr server with gradio 4.31.0. And I use self assigned certificate. Then I use gradio_client to call this sever. When I use gradio 4.31.0(which contains gradio_client 0.16.2), it throws CERTIFICATE_VERIFY_FAILED. But if I downgrade gradio to 4.28.3(which contains gradio_client 0.16.0), it's ok.
Have you searched existing issues? 🔎
Reproduction
model_id = "openai/whisper-large-v3" # update with your model id
device = "cpu" pipe = pipeline( "automatic-speech-recognition", model=model_id, device=device )
def transcribe_speech(filepath): output = pipe( filepath, max_new_tokens=256, generate_kwargs={ "task": "transcribe" }, chunk_length_s=30, batch_size=8, ) return output["text"]
import gradio as gr
demo = gr.Blocks()
mic_transcribe = gr.Interface( fn=transcribe_speech, inputs=gr.Audio(sources="microphone", type="filepath"), outputs=gr.Textbox(), )
file_transcribe = gr.Interface( fn=transcribe_speech, inputs=gr.Audio(sources="upload", type="filepath"), outputs=gr.Textbox(), )
with demo: gr.TabbedInterface( [mic_transcribe, file_transcribe], ["Transcribe Microphone", "Transcribe Audio File"], )
""" openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes """
demo.launch(server_name="0.0.0.0", ssl_certfile="cert.pem", ssl_keyfile="key.pem", ssl_verify=False)
from gradio_client import Client, file
client = Client("https://192.168.0.10:7860", ssl_verify=False)
res = client.predict( filepath=file("en.wav"), api_name="/predict" )
print(res)
Loaded as API: https://192.168.0.10:7860/ ✔ Traceback (most recent call last): File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions yield File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 233, in handle_request resp = self._pool.handle_request(req) File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request raise exc from None File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 196, in handle_request response = connection.handle_request( File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 99, in handle_request raise exc File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 76, in handle_request stream = self._connect(request) File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 154, in _connect stream = stream.start_tls(**kwargs) File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 152, in start_tls with map_exceptions(exc_map): File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/media/lili/mydisk/codes/chatdemo/src/chatdemo/asr_client.py", line 6, in
res = client.predict(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 468, in predict
).result()
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 1480, in result
return super().result(timeout=timeout)
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 445, in result
return self.get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 390, in get_result
raise self._exception
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, *self.kwargs)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 1108, in _inner
predictions = _predict(data)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 1208, in _predict
event_id = self.client.send_data(data, hash_data, self.protocol)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/gradio_client/client.py", line 287, in send_data
req = httpx.post(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_api.py", line 319, in post
return request(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_api.py", line 106, in request
return client.request(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 827, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 914, in send
response = self._send_handling_auth(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 942, in _send_handling_auth
response = self._send_handling_redirects(
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 979, in _send_handling_redirects
response = self._send_single_request(request)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_client.py", line 1015, in _send_single_request
response = transport.handle_request(request)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 232, in handle_request
with map_httpcore_exceptions():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/media/lili/mydisk/codes/chatdemo/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)
server:
Severity
I can work around it