-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
error when downloading files: RuntimeError: File at path /content/undefined does not exist. #3365
Comments
Thanks for filing @MoritzLaurer ! The issue with the filename showing When I upload files myself, I am able to both download the input files and the output zip file |
Thanks for the quick response @freddyaboulton. True, that looks similar, but unfortunately I also get the same error in a totally unrelated script when uploading my own .csv files. Here is the colab: [removed link] |
Thanks for sharing that @MoritzLaurer ! I was able to reproduce the bug in a smaller demo. The problem is that the front-end is not handling well the case when the backend updates the contents of an existing file. import gradio as gr
import tempfile
import pathlib
def translate(input_file):
new_name = str(pathlib.Path(input_file.name).with_name("processed"))
with tempfile.NamedTemporaryFile(mode="w",
prefix=new_name,
delete=False) as f:
f.write(open(input_file.name).read())
return f.name, f.name
with gr.Blocks() as demo:
with gr.Row():
input_file = gr.File(label="Input")
output_file = gr.File(label="Output")
process = gr.Button(value="Process")
process.click(translate, inputs=[input_file], outputs=[input_file, output_file])
demo.launch() You can see that the file on the left (which used to be the input) can't download but the file on the right can be downloaded properly. I would suggest you use separate file components in your demo while we work on a fix! |
Ok, thanks for looking into this @freddyaboulton. Good to know that a separate output file component is a working solution until there is a fix |
Describe the bug
When I upload a file and click submit, the uploaded file appears with a path like "/tmp/filename". When I then try to click on "download", a new browser tab opens and an error appears:
Internal Server Error
.I experience this when uploading + processing a file and then wanting to download it again from the same file component.
The weird thing is that the same code worked a month ago with an older version of gradio and I've also tried it with the latest 3.19. I have the impression that this always happens when the displayed file path is
/temp/filename
instead of just/filename
Is there an existing issue for this?
Reproduction
The same issue also appears with the example code for File in the docs, see here: https://gradio.app/docs/#file-header
Screenshot
new tab that pops up with the error when clicking on download (left column) in the app from the official docs:
Logs
Stack trace from my private/local app:
System Info
Severity
serious, but I can work around it
The text was updated successfully, but these errors were encountered: