Your API Endpoint just returns None, even if all the correct parameters are passed

#63
by Fredtt3 - opened

Hi everyone, I was trying to test with the API Endpoint out of curiosity, and every time I tried I always got this output in the terminal:

@F4k3r22 โžœ /workspaces/codespaces-blank $ python test.py
Loaded as API: https://coqui-xtts.hf.space/--replicas/9fpsc/ โœ”
Traceback (most recent call last):
  File "/workspaces/codespaces-blank/Talk2me/test.py", line 4, in <module>
    result = client.predict(
  File "/usr/local/python/3.10.13/lib/python3.10/site-packages/gradio_client/client.py", line 476, in predict
    ).result()
  File "/usr/local/python/3.10.13/lib/python3.10/site-packages/gradio_client/client.py", line 1513, in result
    return super().result(timeout=timeout)
  File "/usr/local/python/3.10.13/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/local/python/3.10.13/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/local/python/3.10.13/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/python/3.10.13/lib/python3.10/site-packages/gradio_client/compatibility.py", line 65, in _inner
    predictions = self.process_predictions(*predictions)
  File "/usr/local/python/3.10.13/lib/python3.10/site-packages/gradio_client/compatibility.py", line 269, in process_predictions
    predictions = self.deserialize(*predictions)
  File "/usr/local/python/3.10.13/lib/python3.10/site-packages/gradio_client/compatibility.py", line 255, in deserialize
    [
  File "/usr/local/python/3.10.13/lib/python3.10/site-packages/gradio_client/compatibility.py", line 256, in <listcomp>
    s.deserialize(
  File "/usr/local/python/3.10.13/lib/python3.10/site-packages/gradio_client/serializing.py", line 439, in deserialize
    raise ValueError(f"Expected tuple of length 2. Received: {x}")
ValueError: Expected tuple of length 2. Received: None

I pass the Python script, only the URL is changed to the path of the reference voice file:

from gradio_client import Client

client = Client("https://coqui-xtts.hf.space/--replicas/9fpsc/")
result = client.predict(
        "Howdy!",	# str  in 'Text Prompt' Textbox component
        "en,en",	# str (Option from: [('en', 'en'), ('es', 'es'), ('fr', 'fr'), ('de', 'de'), ('it', 'it'), ('pt', 'pt'), ('pl', 'pl'), ('tr', 'tr'), ('ru', 'ru'), ('nl', 'nl'), ('cs', 'cs'), ('ar', 'ar'), ('zh-cn', 'zh-cn'), ('ja', 'ja'), ('ko', 'ko'), ('hu', 'hu'), ('hi', 'hi')]) in 'Language' Dropdown component
        "Voice/Curtis.wav",	# str (filepath on your computer (or URL) of file) in 'Reference Audio' Audio component
        "Voice/Curtis.wav",	# str (filepath on your computer (or URL) of file) in 'Use Microphone for Reference' Audio component
        True,	# bool  in 'Use Microphone' Checkbox component
        True,	# bool  in 'Cleanup Reference Voice' Checkbox component
        True,	# bool  in 'Do not use language auto-detect' Checkbox component
        True,	# bool  in 'Agree' Checkbox component
        fn_index=1
)
print(result)

Bro, did you find a solution to this problem a month later, the same thing?

Sign up or log in to comment