'data' field is missing when predict returns a file
I am using the Gradio API to access a private HF Space and whenever the response is supposed to be a file, I get the following errorFile ".../venv/lib/python3.8/site-packages/gradio_client/serializing.py", line 294, in _deserialize_single
    assert data is not None, f"The 'data' field is missing in {x}"
AssertionError: The 'data' field is missing in {'value': {'name': '/tmp/gradio/b067c151fedfffa4ccf49e831cbe080379a537e3/audio.wav', 'data': None, 'is_file': True}, '__type__': 'update'}Below is the code I am running that is giving the error.client = Client("https://my-private-space.hf.space/", REDACTED_TOKEN=HF_TOKEN)

# generating audio from local language text
result = client.predict(
				"some text",
				"eng: English",
				0.1,
				api_name="/predict"
)According to the error message, the Gradio client on GitHubshould direct code executionto Line 281 in gradio_client/serializing.py, but the code execution jumps toLine 292because it thinks “is_file” should be a key in the main dict it is reading.I am unsure if this is a bug with the Gradio client or if something is wrong with my code that is pushing “is_file” into another dict under the key “value”.Can anyone help with this?
2023-07-14T22:22:28Z
Hi@bluman1- are you returning gr.File.update instead of the path to a new file in your private space? I think that’s what’s causing the issue. I think this is a bug in gradio though. What version of gradio is the space using?
2023-07-14T22:51:52Z
I am using v0.2.8How will I return gr.File.update instead of the path to a new file?The ideal response from the predict endpoint is supposed to be a file that I can save based on the temporary file I can see in the error response - ‘/tmp/gradio/b067c151fedfffa4ccf49e831cbe080379a537e3/audio.wav’Here’s the full error log to make it easierTraceback (most recent call last):
  File ".../code.py", line 8, in <module>
    result = client.predict(
  File "../venv/lib/python3.8/site-packages/gradio_client/client.py", line 285, in predict
    return self.submit(*args, api_name=api_name, fn_index=fn_index).result()
  File "../venv/lib/python3.8/site-packages/gradio_client/client.py", line 982, in result
    raise self.future._exception  # type: ignore
  File "../.pyenv/versions/3.8.5/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "../venv/lib/python3.8/site-packages/gradio_client/client.py", line 646, in _inner
    predictions = self.process_predictions(*predictions)
  File "../venv/lib/python3.8/site-packages/gradio_client/client.py", line 836, in process_predictions
    predictions = self.deserialize(*predictions)
  File "../venv/lib/python3.8/site-packages/gradio_client/client.py", line 822, in deserialize
    [
  File "../venv/lib/python3.8/site-packages/gradio_client/client.py", line 823, in <listcomp>
    s.deserialize(
  File "../venv/lib/python3.8/site-packages/gradio_client/serializing.py", line 349, in deserialize
    return self._deserialize_single(
  File "../venv/lib/python3.8/site-packages/gradio_client/serializing.py", line 294, in _deserialize_single
    assert data is not None, f"The 'data' field is missing in {x}"
AssertionError: The 'data' field is missing in {'value': {'name': '/tmp/gradio/b067c151fedfffa4ccf49e831cbe080379a537e3/audio.wav', 'data': None, 'is_file': True}, '__type__': 'update'}