Unable to call `/run_button` API endpoint via Gradio Python client

#11
by jerenc - opened

Not sure if this is something that can be solved on the Gradio app side but I was unable to run the Python call (example code obtained from Use by API on space):

from gradio_client import Client, handle_file

client = Client("stabilityai/stable-fast-3d")
result = client.predict(
        input_image=handle_file('https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png'),
        foreground_ratio=0.85,
        remesh_option="None",
        vertex_count=-1,
        texture_size=1024,
        api_name="/run_button"
)
print(result)

Here is the trace back I got:

Traceback (most recent call last):
  File "/Users/jeren/tmp/fast.py", line 69, in <module>
    result = client.predict(
             ^^^^^^^^^^^^^^^
  File "/Users/jeren/sand/rigless-char-anim/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 499, in predict
    ).result()
      ^^^^^^^^
  File "/Users/jeren/sand/rigless-char-anim/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 1484, in result
    return super().result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jeren/sand/rigless-char-anim/.pixi/envs/default/lib/python3.12/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/jeren/sand/rigless-char-anim/.pixi/envs/default/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/jeren/sand/rigless-char-anim/.pixi/envs/default/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jeren/sand/rigless-char-anim/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 1080, in _inner
    predictions = _predict(*data, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jeren/sand/rigless-char-anim/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 1194, in _predict
    raise AppError(
gradio_client.exceptions.AppError: The upstream Gradio app has raised an exception but has not enabled verbose error reporting. To enable, set show_error=True in launch().

I was able to run the other 3 endpoints (/update_foreground_ratio, /lambda, /requires_bg_remove) and obtain the resulting images without issues.

Sign up or log in to comment