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

Add a File.download() event #8772

Closed
1 task done
ngaudemet opened this issue Jul 13, 2024 · 5 comments
Closed
1 task done

Add a File.download() event #8772

ngaudemet opened this issue Jul 13, 2024 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers python Backend-related issue (Python) svelte Frontend-related issue (JS)

Comments

@ngaudemet
Copy link

ngaudemet commented Jul 13, 2024

Describe the bug

Thanks for the great job on gradio. The new Chatbot experience of 4.38 seems great.

However I can't upgrade (I'm still on gradio 4.29) since File.select doesn't work anymore.

I believe the bug was introduced in gradio 4.34 when you introduces file.delete in "add delete event to File component #8417".

When you click on a file to download it, it shoud launch a select event as it did before.
It is sometimes crucial to know in the back end what file the user tries to download.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

with gr.Blocks() as demo:
    file = gr.File(value="graph.png")
    files = gr.File(value=["graph.png", "graph.png"], file_count="multiple")
    statement = gr.Textbox(value="No file selected.")

    def on_select(value, evt: gr.EventData):
        return f"The {evt.target} component was selected, and its value was {value}."

    file.select(on_select, file, statement)
    files.select(on_select, file, statement)
demo.launch()

Screenshot

in gradio 4.38.1 (not working)
image

in gradio 4.29.0 (working)
image

Logs

no logs

System Info

doesn't work on gradio 4.38.1
worked very well on gradio 4.29.0, seems to be broken since gradio 4.34.0

Severity

Blocking usage of gradio

@ngaudemet ngaudemet added the bug Something isn't working label Jul 13, 2024
@pngwn
Copy link
Member

pngwn commented Jul 13, 2024

This was a bug sadly, so we cannot bring that behaviour back.

Would an additional download event work?

@ngaudemet
Copy link
Author

ngaudemet commented Jul 13, 2024

Thanks pngwn for your answer.

The select event was not a bug according to me, since it was useful. (The bug was that deleting a file led to a select event, but not for the first file, so it was not consistent and not very understandable, which you corrected in creating the new delete event)

But yes, a download event or a select event would work, either one :)

thanks for you help!

Actually the select event is still documented in File docs.
image

@pngwn
Copy link
Member

pngwn commented Jul 13, 2024

Actually ignore what I said. The select event should indeed fire.

Will see what we can do!

@abidlabs abidlabs added the Priority High priority issues label Jul 15, 2024
@ngaudemet
Copy link
Author

Hello @pngwn how are you? Have you any news about this issue? Thanks a lot !

@abidlabs abidlabs added Regression Bugs did not exist in previous versions of Gradio and removed Priority High priority issues labels Oct 10, 2024
@abidlabs abidlabs changed the title File.select doesn't work anymore Add a File.download() event Oct 18, 2024
@abidlabs abidlabs added enhancement New feature or request good first issue Good for newcomers labels Oct 18, 2024
@abidlabs abidlabs added svelte Frontend-related issue (JS) python Backend-related issue (Python) and removed bug Something isn't working Regression Bugs did not exist in previous versions of Gradio labels Oct 30, 2024
@abidlabs
Copy link
Member

abidlabs commented Nov 2, 2024

Closed via #9887

@abidlabs abidlabs closed this as completed Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers python Backend-related issue (Python) svelte Frontend-related issue (JS)
Projects
None yet
Development

No branches or pull requests

3 participants