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

Download button does not respect the filepath returned by the function #1689

Closed
1 task done
freddyaboulton opened this issue Jul 1, 2022 · 5 comments · Fixed by #1921 or #2073
Closed
1 task done

Download button does not respect the filepath returned by the function #1689

freddyaboulton opened this issue Jul 1, 2022 · 5 comments · Fixed by #1921 or #2073
Assignees
Labels
bug Something isn't working
Milestone

Comments

@freddyaboulton
Copy link
Collaborator

freddyaboulton commented Jul 1, 2022

Describe the bug

In the zip_two_files demo:

import os
from zipfile import ZipFile

import gradio as gr


def zip_two_files(file1, file2):
    with ZipFile("tmp.zip", "w") as zipObj:
        zipObj.write(file1.name, "file1")
        zipObj.write(file2.name, "file2")
    return "tmp.zip"


demo = gr.Interface(
    zip_two_files,
    ["file", "file"],
    "file",
    examples=[
        [os.path.join(os.path.dirname(__file__),"files/titanic.csv"), 
         os.path.join(os.path.dirname(__file__),"files/titanic.csv")],
    ],
)

if __name__ == "__main__":
    demo.launch()

When you download the file, it is renamed download.zip by default on Chrome.

Download version 3.0.22

file_download_bug

That's not the case on version 3.0.12. The file is called tmp because that's what the prediction function returns. You can see the same behavior on this space: https://huggingface.co/spaces/radames/dpt-depth-estimation-3d-obj Was this change intentional?

Download version 3.0.12

file_download_correct

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

Run the zip_two_files demo on 3.0.22 and download the file.

Screenshot

No response

Logs

-

System Info

3.0.22

Severity

annoying

@freddyaboulton freddyaboulton added the bug Something isn't working label Jul 1, 2022
@AeroDEmi
Copy link

AeroDEmi commented Jul 1, 2022

Thank you for addressing the bug @freddyaboulton. This came as my output is a mesh file (file.msh) and when I try to download the file it losses the .msh extension.

@freddyaboulton
Copy link
Collaborator Author

Thank you for bringing it to our attention!

@freddyaboulton freddyaboulton changed the title Download button does not respect the filepath returned by the interpretation function Download button does not respect the filepath returned by the function Jul 5, 2022
@irfan-mekic
Copy link

Any updates on this?

@freddyaboulton freddyaboulton added this to the 3.2 milestone Aug 1, 2022
@freddyaboulton
Copy link
Collaborator Author

@irfan-mekic Thanks for the follow-up!

We were working on improving the docs the last two weeks. Next we're working on the 3.2 milestone which will focus on bug fixes. I've added this issue to that milestone so someone will take a look at this soon.

@abidlabs
Copy link
Member

Reopening as this seems to have come back as a results of #1967

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment