Issue with Example Code in Hugging Face Space - Gradio AppError for Photo Restoration

Hi everyone,

I’m unsuccessfully trying to use an image restoration on an Hugging Face shared space from API.

working with the example code provided in the Hugging Face space for Old Photo Restoration using gradio_client.
Following the example exactly as it’s shown in the space, I’m running into this error:

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

Interestingly, the model works without issues when run directly on the Hugging Face space UI online, but calling it via the API consistently returns this error.

Here’s the code I’m using (directly from the example provided):

from gradio_client import Client

client = Client("https://modelscope-old-photo-restoration.hf.space/--replicas/l754q/")
result = client.predict(
    "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png",  # filepath for 'image' Image component
    api_name="/predict"
)
print(result)

I’ve tried Including an HF token in the Client constructor to ensure it isn’t an authorization issue

I’ve tried Using a local file path for the image instead of a URL.
I’ve tried also loading the base64 of the image getting the same error.

It outputs

Loaded as API: https://modelscope-old-photo-restoration.hf.space/--replicas/l754q/ ✔
AppError: The upstream Gradio app has raised an exception but has not enabled verbose error reporting. To enable, set show_error=True in launch().

and it takes about 5 seconds to get the error.

Has anyone else experienced this issue with Gradio API calls? Are there additional configuration settings we may need for successful remote calls, or a way to enable verbose error reporting to get more insights on what’s going wrong?

1 Like

As the error message says, the author of Spaces has turned off debug messages, so we don’t know the exact cause.
However, that error often occurs when the version of Gradio used in the Space is different from the version of Gradio installed on your local machine.
Please try matching the version of Gradio on your local machine to the version used in the Space.

pip install -U gradio
1 Like