gradio icon indicating copy to clipboard operation
gradio copied to clipboard

gradio_client: 429 TooManyRequests on an AttributeError

Open Pendrokar opened this issue 1 year ago • 0 comments

Describe the bug

When trying to connect to Gradio Spaces multiple times, I occasionally get the error AttributeError("'Client' object has no attribute 'src_prefixed'")

Connection errors out on the first try and then crashes as 'self.src_prefixed' was never set. https://github.com/gradio-app/gradio/blob/gradio%405.0.2/client/python/gradio_client/client.py#L866-L874

print(r) in that area of code gives the actual reason for failing to connect, which is: 429 Too Many Requests

Gradio 5 shows the wrong error at fault.

Have you searched existing issues? 🔎

  • [X] I have searched and found no existing issues

Reproduction

import os
from gradio_client import Client

client = Client("coqui/xtts", hf_token=os.getenv('HF_TOKEN'))
#occurs with and without token

result = client.predict(
        "Quick test.",	# str  in 'What should I say!? (max 512 characters).' Textbox component
        'en', #lang
        'https://cdn-uploads.huggingface.co/production/uploads/63d52e0c4e5642795617f668/V6-rMmI-P59DA4leWDIcK.wav', # voice sample
        None, # mic voice sample
        False, #use_mic
        False, #cleanup_reference
        False, #auto_detect
        True, #ToS
		fn_index=1
)

Run multiple times... at some point

Screenshot

No response

Logs

Traceback (most recent call last):
  File "/home/user/app/test_tts_xva.py", line 4, in <module>
    client = Client("coqui/xtts", hf_token=os.getenv('HF_TOKEN'))
  File "/usr/local/lib/python3.10/site-packages/gradio_client/client.py", line 153, in __init__
    self.config = self._get_config()
  File "/usr/local/lib/python3.10/site-packages/gradio_client/client.py", line 874, in _get_config
    self.src_prefixed,
AttributeError: 'Client' object has no attribute 'src_prefixed'

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 5.0.2
gradio_client version: 1.4.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.6.0
fastapi: 0.115.2
ffmpy: 0.4.0
gradio-client==1.4.0 is not installed.
httpx: 0.27.2
huggingface-hub: 0.25.2
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 2.0.2
orjson: 3.10.7
packaging: 24.1
pandas: 2.2.3
pillow: 10.4.0
pydantic: 2.9.2
pydub: 0.25.1
python-multipart: 0.0.12
pyyaml: 6.0.2
ruff: 0.6.9
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.5
typing-extensions: 4.12.2
urllib3: 2.2.3
uvicorn: 0.31.1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.

gradio_client dependencies in your environment:

fsspec: 2024.6.1
httpx: 0.27.2
huggingface-hub: 0.25.2
packaging: 24.1
typing-extensions: 4.12.2
websockets: 12.0

Severity

I can work around it

Pendrokar avatar Oct 12 '24 22:10 Pendrokar