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

Using gr.update(value=np.array(...)) Disables Brush Painting in gr.ImageMask #10614

Open
1 task done
gkalstn000 opened this issue Feb 18, 2025 · 0 comments
Open
1 task done
Labels
bug Something isn't working 🖼️ ImageEditor

Comments

@gkalstn000
Copy link

gkalstn000 commented Feb 18, 2025

Describe the bug

When using the gr.ImageMask component in a Gradio interface, the brush painting functionality works as expected when an image is uploaded via the web interface. However, if the component is updated programmatically with gr.update(value=np.array(...)), the brush painting feature stops working entirely.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

Steps to Reproduce:

  1. Initialize the component:
canvas = gr.ImageMask(sources='upload', type="numpy")

Upload an image through the web interface.
Use the brush tool to paint on the canvas (this should work normally).

Update the component internally using:

image = gr.Image(sources='upload', type="numpy")
canvas = gr.ImageMask(sources='upload', type="numpy")

image.upload(fn=update_cnavas, inputs=image, outputs=canvas)

def update_cnavas(image) :
    return gr.update(value=image)

Observe that after the update, the brush painting functionality is completely disabled.

Screenshot

2025-02-18.3.02.34.mov

Logs

System Info

Gradio version: 5.16.0
Browser: chrome
Operating System: Ubuntu 24.04 LTS

Severity

I can work around it

@gkalstn000 gkalstn000 added the bug Something isn't working label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🖼️ ImageEditor
Projects
None yet
Development

No branches or pull requests

2 participants