Hi, thanks so much for your work on Gradio.
I am using gradio.image with two distinct events, image.upload to detect when an image is provide and image.clear to detect when it is clear. However, I have an issue with the past option. Indeed, I realise that when you past an image (cf the screenshot)
both the event image.upload and image.clear are triggered. I checked the documentation (https://www.gradio.app/docs/gradio/image) and the image.clear event as described in the doc should't be triggered as no user used the X button of the component.
It really block me for my work. Could it be possible to clean this behaviour? The best would be to create a image.past event that is only triggered when you past an image, and change the behavior of image.upload (making it only being triggered by the upload option) and image.clear (only triggered when a real clear is made)
Have you searched existing issues? 🔎
[X] I have searched and found no existing issues
Reproduction
import gradio as gr
with gr.Blocks() as io:
title = gr.Markdown("1")
image = gr.Image(
show_download_button=True,
type="filepath",
elem_id="imagebox",
)
image.upload(
fn=(lambda image: print("Upload triggered!")),
inputs=[image],
outputs=[],
).then(
fn=(lambda image: print("Upload complete!")),
inputs=[image],
outputs=[],
)
image.clear(
fn=(lambda image: print("Clear triggered!")),
inputs=[image],
outputs=[],
).then(
fn=(lambda image: print("Clear complete!")),
inputs=[image],
outputs=[],
)
io.launch()
A really simple code to show in logs that when you past an image, both the clear and upload event are triggered. (I use python 3.11.0)
Describe the bug
Hi, thanks so much for your work on Gradio. I am using gradio.image with two distinct events,
image.upload
to detect when an image is provide andimage.clear
to detect when it is clear. However, I have an issue with the past option. Indeed, I realise that when you past an image (cf the screenshot) both the eventimage.upload
andimage.clear
are triggered. I checked the documentation (https://www.gradio.app/docs/gradio/image) and theimage.clear
event as described in the doc should't be triggered as no user used the X button of the component.It really block me for my work. Could it be possible to clean this behaviour? The best would be to create a
image.past
event that is only triggered when you past an image, and change the behavior ofimage.upload
(making it only being triggered by the upload option) andimage.clear
(only triggered when a real clear is made)Have you searched existing issues? 🔎
Reproduction
A really simple code to show in logs that when you past an image, both the clear and upload event are triggered. (I use
python 3.11.0
)Screenshot
No response
Logs
No response
System Info
Severity
Blocking usage of gradio