Open pablovela5620 opened 3 months ago
Another example where it fails is the official example https://huggingface.co/spaces/radames/gradio_rerun
from gradio_client import Client, file
client = Client("radames/gradio_rerun")
result = client.predict(
img=file('https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png'),
api_name="/streaming_repeated_blur"
)
print(result)
the version that provides the rrd without yield/streaming works fine
from gradio_client import Client
client = Client("radames/gradio_rerun")
result = client.predict(
x=5,
y=5,
z=5,
api_name="/create_cube_rrd"
)
print(result)
Loaded as API: http://127.0.0.1:7862/ ✔ /Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/utils.py:1097: UserWarning: file() is deprecated and will be removed in a future version. Use handle_file() instead. warnings.warn( Traceback (most recent call last): File "/Users/pablovela/0Dev/personal/inference-hf-spaces/main.py", line 4, in
result = client.predict(
^^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 463, in predict
).result()
^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 1485, in result
return super().result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/concurrent/futures/_base.py", line 456, in result
return self.get_result()
^^^^^^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/concurrent/futures/_base.py", line 401, in get_result
raise self._exception
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, *self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 1113, in _inner
predictions = self.process_predictions(predictions)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 1278, in process_predictions
predictions = self.download_files(*predictions)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 1291, in downloadfiles
data = utils.traverse(data_, self._download_file, utils.is_file_obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/utils.py", line 984, in traverse
new_obj.append(traverse(item, func, is_root))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/utils.py", line 975, in traverse
return func(json_obj)
^^^^^^^^^^^^^^
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/gradio_client/client.py", line 1369, in _download_file
response.raise_for_status()
File "/Users/pablovela/0Dev/personal/inference-hf-spaces/.pixi/envs/default/lib/python3.12/site-packages/httpx/_models.py", line 761, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '403 Forbidden' for url 'http://127.0.0.1:7862/file=6f7c8fd3-3c02-4b2b-95c3-d31966b2d4ea/138970045808400/16'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
I'm guessing its because its providing back a URL from the rerun rrd file that isn't accessible?
This is what the current gradio UI looks like, I'm using yield + generator and I think that's probably part of the issue? if I do the same thing with https://huggingface.co/spaces/pablovela5620/mini-dust3r and it works fine if I run, but this is with gradio_rerun==0.0.1 and is not using yield but returning the rrd file