The Gradio API isn't working.

#6
by roshanbiswa - opened

The Gradio API is giving error when trying to predict using the gradio client.
It seems that the gradio app errors out whenever accessed via the given api definition.
Should there be a change in the API Definition or The Gradio App doesn't allow inference via API.

client = Client("https://levihsu-ootdiffusion.hf.space/--replicas/6urx6/")
result = client.predict(
        "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png",	# filepath  in 'Model' Image component
        "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png",	# filepath  in 'Garment' Image component
        "Upper-body",	# Literal['Upper-body', 'Lower-body', 'Dress']  in 'Garment category (important option!!!)' Dropdown component
        1,	# float (numeric value between 1 and 4) in 'Images' Slider component
        20,	# float (numeric value between 20 and 40) in 'Steps' Slider component
        2,	# float (numeric value between 1.0 and 5.0) in 'Guidance scale' Slider component
        -1,	# float (numeric value between -1 and 2147483647) in 'Seed' Slider component
        api_name="/process_dc"
)
print(result)

The above code gives the following error:
\env\Lib\site-packages\gradio_client\client.py", line 1227, 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().

Have you solved this issue? I got the same error

Have you solved this issue? I got the same error

Please anyone has the solution?

I'm getting the same error.

Could the issue be related to the version of Gradio? That's crazy..
No, it's not. Gradio 0.17 has the same issue.

Could the issue be related to the version of Gradio? That's crazy..

It’s seems other APIs work. So far all the multimodal models I tried haven’t worked.

I have updated gradio and it works now....

With the Metric3D API I solved it with: handle_file

result = client.predict(
handle_file(picture_path), # filepath in 'Original Image' Image component
"vit-large", # Literal['vit-small', 'vit-large'] in 'Model' Dropdown component
fx, # float in 'fx in pixels' Number component
fy, # float in 'fy in pixels' Number component
api_name="/predict_depth_normal"
)

I have updated gradio and it works now....

what is your gradio version ?
my gradio version is 4.36.1 , but still have same error...

Step 1
Go to the Access Tokens page in your personal profile and set the necessary permissions.
Step 2
Add your token to your project using the following code snippet:
client = Client("HumanAIGC/OutfitAnyone", hf_token="hf_xxx")

This should work, but you might encounter an error if you use images of models that are not from their website.
https://huggingface.co/spaces/HumanAIGC/OutfitAnyone

It seems we can't use custom model images at the moment. ( ?

AppError: The upstream Gradio app has raised an exception but has not en abled verbose error reporting. To enable, set show_error=True in launch().

does any one have solution

AppError: The upstream Gradio app has raised an exception but has not en abled verbose error reporting. To enable, set show_error=True in launch().

does any one have solution

i dont think so. please do update when you find one

i get the same error when I upload an image using the gradio library.

Open your main file:
app.py

Look for:
...launch()

Change it to:

.launch(show_error=True)

There you go! Show error enabled.

πŸ‡§πŸ‡·

Hello,

I seemed to have resolved the error by adding handle_file to predict parameters

So instead of having something like

result = client.predict(
        "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png",	# filepath  in 'Model' Image component
        "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png",	# filepath  in 'Garment' Image component
        api_name="/process_dc"
)
print(result)

It would be something more like

from gradio_client import handle_file

result = client.predict(
        handle_file("https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png"),	# filepath  in 'Model' Image component
        handle_file("https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png"),	# filepath  in 'Garment' Image component
        api_name="/process_dc"
)
print(result)

This may not be the exact reason as to why you're getting the original error, but it worked for the API and Client I was testing with.

Hope this helps!

Sign up or log in to comment