Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error messages with the Python Client #7889

Closed
abidlabs opened this issue Mar 29, 2024 · 1 comment · Fixed by #8264
Closed

Better error messages with the Python Client #7889

abidlabs opened this issue Mar 29, 2024 · 1 comment · Fixed by #8264
Assignees
Labels
enhancement New feature or request gradio_client Related to the one of the gradio client libraries python Backend-related issue (Python)

Comments

@abidlabs
Copy link
Member

If an invalid value is provided using the Python Client, then the error that is raised is not very informative. We should transmit the error from the server to the client to provide better error messages.

E.g.

from gradio_client import Client, file

client = Client("abidlabs/whisper")

client.predict(
    audio="abc"
)

Here "abc" needs to be a file not a string, but the Client currently produces:

ValueError: None
@abidlabs abidlabs added enhancement New feature or request python Backend-related issue (Python) gradio_client Related to the one of the gradio client libraries labels Mar 29, 2024
@abidlabs abidlabs added this to the Clients 1.0 📡 milestone Mar 29, 2024
@abidlabs abidlabs self-assigned this Apr 9, 2024
@SrijanSahaySrivastava
Copy link
Contributor

Hey, I was able to reproduce this and I was thinking of doing a check of all args passed with isinstance() but idk what should I be checking them against

eg.:-
(if we wanna check if argument is int)
for arg in args:
if not isinstance(arg, int):
raise ValueError(f"Invalid argument: {arg}. All arguments must be integers.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gradio_client Related to the one of the gradio client libraries python Backend-related issue (Python)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants