You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to obtain a binarized mask file through handwriting (with background as 0 and foreground as 1). However, when using gr.Sketchpador gr.ImageMask , if the image mode is set to "L", the output is an array of all zeros.
when i change the color of the pencil to white, the output is correct, but i can't see what is draw.
I found that this is because the program defaults to a background of all zeros and the pen default value is also zero, so the handwritten content cannot be seen. This is different from the old version of sketchpad.
Have you searched existing issues? 🔎
I have searched and found no existing issues
Reproduction
importgradioasgrimportnumpyasnpdefsleep(im):
a=im["composite"]
b=a.shapec=np.max(a)
returna, f'the image size is {b},\n the max value is {c}'withgr.Blocks() asdemo:
withgr.Group():
withgr.Row():
out=gr.Textbox()
withgr.Row():
im=gr.Sketchpad(type="numpy",image_mode="L")
im_out_1=gr.Image(type="pil")
im.change(sleep, outputs=[im_out_1, out], inputs=im)
demo.launch()
Screenshot
Logs
No response
System Info
gradio==4.24.0
windows
Severity
I can work around it
The text was updated successfully, but these errors were encountered:
Describe the bug
I want to obtain a binarized mask file through handwriting (with background as 0 and foreground as 1). However, when using gr.Sketchpador gr.ImageMask , if the image mode is set to "L", the output is an array of all zeros.
when i change the color of the pencil to white, the output is correct, but i can't see what is draw.
I found that this is because the program defaults to a background of all zeros and the pen default value is also zero, so the handwritten content cannot be seen. This is different from the old version of sketchpad.
Have you searched existing issues? 🔎
Reproduction
Screenshot
Logs
No response
System Info
Severity
I can work around it
The text was updated successfully, but these errors were encountered: