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

Simplify how files are passed into the JS Client (and make consistent with Python Client) #8082

Open
abidlabs opened this issue Apr 19, 2024 · 3 comments
Assignees
Labels
gradio_client Related to the one of the gradio client libraries refactor Involves refactoring existing code svelte Frontend-related issue (JS)

Comments

@abidlabs
Copy link
Member

Follow up from #7646:

If you look at the view API page for any endpoint that involves uploading a file, the file dictionary in the payload is very complex, e.g.:

image

image

This is technically correct, but it would be nice to wrap this in a helper function so users don't have to think about all of the fields. For the Python Client, we have a file() helper function that just takes in the path to the file and populates the rest of the fields accordingly, maybe we could do the same for the js client.

@abidlabs abidlabs added refactor Involves refactoring existing code svelte Frontend-related issue (JS) gradio_client Related to the one of the gradio client libraries labels Apr 19, 2024
@abidlabs abidlabs added this to the @gradio/client 1.0 milestone Apr 19, 2024
@pngwn
Copy link
Member

pngwn commented May 3, 2024

Is this an artifact of the recorder or is this how it displays in all cases?

We used to fetch a file and pass that in as a blob/buffer.

@abidlabs
Copy link
Member Author

abidlabs commented May 3, 2024

In the other case, the code snippets involve blobs and fetch etc but I feel like that should be abstracted inside a file() method as well as discussed with @hannahblair

@pngwn
Copy link
Member

pngwn commented May 3, 2024

Seems reasonable. We cant use file though as that is a built in. We will need to come up with another name.

@hannahblair hannahblair self-assigned this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gradio_client Related to the one of the gradio client libraries refactor Involves refactoring existing code svelte Frontend-related issue (JS)
Projects
None yet
Development

No branches or pull requests

3 participants