Spaces:
Running on Zero
Running on Zero
Why my api can't work
#30
by BigfufuOuO - opened
I use api as instructed in document
from gradio_client import Client, handle_file
client = Client("hkchengrex/MMAudio")
result = client.predict(
video=handle_file('https://github.com/gradio-app/gradio/raw/main/gradio/media_assets/videos/world.mp4'),
prompt="Hello!!",
negative_prompt="music",
seed=-1,
num_steps=25,
cfg_strength=4.5,
duration=8,
api_name="/video_to_audio"
)
print(result)
But it always show TypeError like this:
Traceback (most recent call last):
File "/home/workspace/audioGnew/tool/base.py", line 168, in _predict
return self._client.predict(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data2/miniconda3/envs/llm60/lib/python3.11/site-packages/gradio_client/client.py", line 499, in predict
).result()
^^^^^^^^
File "/data2/miniconda3/envs/llm60/lib/python3.11/site-packages/gradio_client/client.py", line 1484, in result
return super().result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data2/miniconda3/envs/llm60/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/data2/miniconda3/envs/llm60/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/data2/miniconda3/envs/llm60/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data2/miniconda3/envs/llm60/lib/python3.11/site-packages/gradio_client/client.py", line 1080, in _inner
predictions = _predict(*data, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data2/miniconda3/envs/llm60/lib/python3.11/site-packages/gradio_client/client.py", line 1200, in _predict
raise AppError(message=message, **result)
gradio_client.exceptions.AppError: TypeError
This might be best directed to HF staff, e.g., https://discuss.huggingface.co/c/spaces
cc @victor @hysts
Hi @hkchengrex , the error is due to this incorrect type annotation. https://huggingface.co/spaces/hkchengrex/MMAudio/blob/7d49f3e21be63c01111560f71e7b5e41ba49135b/app.py#L78
I just opened a PR to fix it. https://huggingface.co/spaces/hkchengrex/MMAudio/discussions/31
@hysts Thanks!