Unable to inference from space in python using API
I want to inference via API usinggradio_clientfromhttps://huggingface.co/spaces/jadechoghari/ferret-demo. I have been unable to do it as I get the following error.python3.11/site-packages/gradio_client/client.py", line 885, in _get_config     raise ValueError(f"Could not fetch config for {self.src}") ValueError: Could not fetch config for https://huggingface.co/spaces/jadechoghari/ferret-demo/Following is the python code I’m executing:from gradio_client import Client, handle_file

client = Client("https://huggingface.co/spaces/jadechoghari/ferret-demo")
result = client.predict(
		chatbot=[],
		image_data=handle_file(image_path),
		prompt=prompt,
		model_path="jadechoghari/Ferret-UI-Gemma2b",
		temperature=0.2,
		top_p=0.7,
		max_new_tokens=512,
		api_name="/inference_with_gradio"
)
print(result)
2024-10-26T08:15:02Z
Your code is a bit wrong, but my local environment is Python 3.9, so I can’t try Gradio5…Hope it works…REDACTED_TOKEN = "hf_********"
#client = Client("https://huggingface.co/spaces/jadechoghari/ferret-demo")
client = Client("jadechoghari/ferret-demo", REDACTED_TOKEN=REDACTED_TOKEN)pip install gradio==5.1.0
pip install -U gradio-client
2024-10-27T10:13:05Z
adityaqqa:I want to inference via API usinggradio_clientfromhttps://huggingface.co/spaces/jadechoghari/ferret-demosurah yaseen pdf. I have been unable to do it as I get the following error.python3.11/site-packages/gradio_client/client.py", line 885, in _get_config     raise ValueError(f"Could not fetch config for {self.src}") ValueError: Could not fetch config for https://huggingface.co/spaces/jadechoghari/ferret-demo/Following is the python code I’m executing:from gradio_client import Client, handle_file

client = Client("https://huggingface.co/spaces/jadechoghari/ferret-demo")
result = client.predict(
		chatbot=[],
		image_data=handle_file(image_path),
		prompt=prompt,
		model_path="jadechoghari/Ferret-UI-Gemma2b",
		temperature=0.2,
		top_p=0.7,
		max_new_tokens=512,
		api_name="/inference_with_gradio"
)
print(result)The answer of@John6666is valuable and understanding by me. It helps a lot.
2024-10-29T08:39:13Z
@John6666Not working. here is the logLoaded as API: https://jadechoghari-ferret-demo.hf.space ✔

Traceback (most recent call last):
  File "/Users/QQAGHN0037/PycharmProjects/FerretUI/main.py", line 13, in <module>
    result = client.predict(
             ^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/FerretUI/lib/python3.11/site-packages/gradio_client/client.py", line 476, in predict
    ).result()
      ^^^^^^^^
  File "/opt/anaconda3/envs/FerretUI/lib/python3.11/site-packages/gradio_client/client.py", line 1509, in result
    return super().result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/FerretUI/lib/python3.11/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/FerretUI/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/anaconda3/envs/FerretUI/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/FerretUI/lib/python3.11/site-packages/gradio_client/client.py", line 1128, in _inner
    predictions = _predict(*data)
                  ^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/FerretUI/lib/python3.11/site-packages/gradio_client/client.py", line 1240, 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().
2024-10-29T08:43:38Z
Hmmm, since I can’t test it, you’ll have to…You can try the same program in any of the other spaces and see if that doesn’t work, which will determine what you should try next. If it’s a problem with that space, you’ll have to contact the author or duplicate and modify it for your own use. If it’s an error in your environment, changing a setting might fix it.