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

UI crashes in gr.Image with tool="color-sketch" and a pre-loaded image #3248

Closed
Tracked by #466
apolinario opened this issue Feb 20, 2023 · 2 comments · Fixed by #3277
Closed
Tracked by #466

UI crashes in gr.Image with tool="color-sketch" and a pre-loaded image #3248

apolinario opened this issue Feb 20, 2023 · 2 comments · Fixed by #3277
Assignees
Labels
bug Something isn't working 🖼️ image Image component

Comments

@apolinario
Copy link
Contributor

apolinario commented Feb 20, 2023

Describe the bug

Running the following code

#Create a black image
img = Image.new("RGB", (512, 512), (0, 0, 0))
img.save("image.png", "PNG")
#Pre-load the black image in the component
gr.Image(value="image.png", interactive=True, tool="color-sketch")

Crashes the UI
image

Reproduction

Here's a colab with an example: https://colab.research.google.com/drive/1Gp5pp51P14B0tM331dS7476-Oqe-Bi04

System Info

3.19.0

Severity

serious, but I can work around it

@apolinario apolinario added the bug Something isn't working label Feb 20, 2023
@apolinario
Copy link
Contributor Author

apolinario commented Feb 21, 2023

The UI equally crashes if I do something like:

def update_image():
  return gr.update(value="image.png")

image = gr.Image(interactive=True, tool="color-sketch")
# ... 
demo.load(update_image, inputs=[], outputs=image)

And given that the source="canvas" can only initialize with a white canvas, I'm currently failing to see any way to initialise a color-sketch with a black image to be drawn on top

Actually uploading the image does work tho.

@pngwn
Copy link
Member

pngwn commented Feb 21, 2023

This is due to a resize loop, the canvas gets too big and eventually crashes. Surprised it isn't happening when uploading an image though.

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

Successfully merging a pull request may close this issue.

2 participants