Closed freddyaboulton closed 1 year ago
When trying to use this whisper space via the client, I got an error when supplying a value for the state in my call to predict.
I instantiated the client like this
import gradio_client as grc client = grc.Client("abidlabs/whisper-large-v2")
view_api() told me I had to pass in a state component
view_api()
Client.predict() Usage Info --------------------------- Named API endpoints: 1 - predict(microphone, state, api_name="/predict") -> (output_0, state) Parameters: - [Audio] microphone: str (filepath or URL to file) - [State] state: Any () Returns: - [Textbox] output_0: str (string value) - [State] state: Any ()
But then that lead to an error
client.predict("/Users/freddy/sources/gradio/demo/same-person-or-different/samples/heath_ledger.mp3", " ", api_name="/predict")
----> 1 client.predict("/Users/freddy/sources/gradio/demo/same-person-or-different/samples/heath_ledger.mp3", " ", api_name="/predict") ~/sources/gradio/client/python/gradio_client/client.py in predict(self, api_name, fn_index, *args) 250 >> 9.0 251 """ --> 252 return self.submit(*args, api_name=api_name, fn_index=fn_index).result() 253 254 def submit( ~/sources/gradio/client/python/gradio_client/client.py in result(self, timeout) 907 raise TimeoutError() 908 if self.future._exception: # type: ignore --> 909 raise self.future._exception # type: ignore 910 with self.communicator.lock: 911 if self.communicator.job.outputs: ~/miniconda3/envs/gradio/lib/python3.8/concurrent/futures/thread.py in run(self) 55 56 try: ---> 57 result = self.fn(*self.args, **self.kwargs) 58 except BaseException as exc: 59 self.future.set_exception(exc) ~/sources/gradio/client/python/gradio_client/client.py in _inner(*data) 592 raise utils.InvalidAPIEndpointError() 593 if self.client.serialize: --> 594 data = self.serialize(*data) 595 predictions = _predict(*data) 596 if self.client.serialize: ~/sources/gradio/client/python/gradio_client/client.py in serialize(self, *data) 723 if input_component_type == utils.STATE_COMPONENT: 724 data.insert(i, None) --> 725 assert len(data) == len( 726 self.serializers 727 ), f"Expected {len(self.serializers)} arguments, got {len(data)}" AssertionError: Expected 2 arguments, got 3
removing the second argument (the state) fixes the error
If the state is not expected to be passed in - then maybe we should remove it from the view_api?
Above^
No response
-
3.27.0
annoying
Also the state is omitted from the output as well
same question
Working on this now
Describe the bug
When trying to use this whisper space via the client, I got an error when supplying a value for the state in my call to predict.
I instantiated the client like this
view_api()
told me I had to pass in a state componentBut then that lead to an error
removing the second argument (the state) fixes the error
If the state is not expected to be passed in - then maybe we should remove it from the view_api?
Is there an existing issue for this?
Reproduction
Above^
Screenshot
No response
Logs
System Info
Severity
annoying