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

.input() is missing in gr.Image and gr.Audio #8831

Closed
1 task done
hysts opened this issue Jul 18, 2024 · 3 comments · Fixed by #8836
Closed
1 task done

.input() is missing in gr.Image and gr.Audio #8831

hysts opened this issue Jul 18, 2024 · 3 comments · Fixed by #8836
Assignees
Labels
bug Something isn't working

Comments

@hysts
Copy link
Collaborator

hysts commented Jul 18, 2024

Describe the bug

internal Slack

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

with gr.Blocks() as demo:
    image = gr.Image(interactive=True)
    image.input(fn=lambda: print("foo"))
demo.launch()

Screenshot

No response

Logs

Traceback (most recent call last):
  File "/tmp/app.py", line 5, in <module>
    image.input(fn=lambda: print("foo"))
AttributeError: 'Image' object has no attribute 'input'

System Info

gradio==4.38.1

Severity

Blocking usage of gradio

@hysts hysts added the bug Something isn't working label Jul 18, 2024
@abidlabs abidlabs self-assigned this Jul 18, 2024
@ngaudemet
Copy link

Hi gradio Team :)
what would be the difference between gr.Image.upload() dans gr.Image.input()?
I’ve seen you fixed the issue but not sure to understand what would the .input event add compared to an upload event ? the event documentation is not very clear to me, and I can’t read your internal slack where you seem to describe the issue .
thanks !

@abidlabs
Copy link
Member

Hi @ngaudemet! The .input() event is fired whenever the user changes the value of the Image component through the UI. This would mean, for example, if the user clears the image. However, .upload() is only fired when a new image is actually uploaded.

@ngaudemet
Copy link

thanks @abidlabs! It's clearer for me now. Concerning events, the gr.File.select() still doesn't work anymore, though it is very useful when you want to know in the back end that a user selected a file in the front end :) cf issue #8772

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants