i tried loading my space as an API through gradio client and it went down smoothly but when i try calling the named api for prediction on an image which is stored locally on my system or be it an URL there’s an error on the space log as : pydantic_core._pydantic_core.ValidationError: 1 validation error for ImageData
Input should be a valid dictionary or instance of ImageData [type=model_type, input_value=‘/9j/4AAQSkZJRgABAQAAAQAB…ULMJAMBsggdfzODQi4rU//Z’, input_type=str]
For further information visit Redirecting...

i tried encoding it in base64 and i also updated my app.py script on how to process and return requests. but the issue persists. please any kind of help is appreciated.

2 Likes

bro got any solution ?? its 2 am now still struggling to resolve :frowning:

1 Like

It seems that the documentation says to use handle_file (do not send base64 directly)…

from gradio_client import Client, handle_file

client = Client("user/space-name")
res = client.predict(image=handle_file("./cat.jpg"), api_name="/predict") # local file
res = client.predict(image=handle_file("https://example.com/cat.jpg"), api_name="/predict") # URL