Respect original filename when cached example files are downloaded#2145
Merged
Conversation
Contributor
|
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-2145-all-demos |
d84a38b to
732777d
Compare
Member
|
Just merged 3.2 in here so the tests pass |
c7725a4 to
e434446
Compare
e26f9af to
1149020
Compare
Member
|
LGTM, but there is a deeper problem that you point out, which is the for cached file examples, we first serialize them to base64 (thereby losing the extension information), and then the browser has to convert them to a file for download. We really should avoid this, but for now, let's file an issue and take a look later @freddyaboulton? |
abidlabs
approved these changes
Sep 6, 2022
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #2140
The downloaded filename is the same as what is returned from the prediction function now but you'll note that the extension for the file in the Model3D demo is messed up.
This is because when the output is cached, we return a base64 representation of the file as opposed to serving the file itself. The data streams for Model3D files have
application/x-tgifandapplication/octet-streammime types and I think Chrome can't guess the file extension for those mime types.To get around this we'd have to serve the file for examples too but decided to hold off and hear other's thoughts on the matter.
Checklist: