gradio icon indicating copy to clipboard operation
gradio copied to clipboard

Can't change SketchPad size

Open xenova opened this issue 3 years ago • 1 comments

Describe the bug

Sketchpad stops working once you resize it using the .style() method (introduced https://github.com/gradio-app/gradio/issues/1561)

Is there an existing issue for this?

  • [X] I have searched the existing issues

Reproduction

import gradio as gr
from PIL import Image

def predict(img):
    return Image.new('L', (256, 256))

sp = gr.Sketchpad().style(height=400, width=400)

gr.Interface(fn=predict,
             inputs=sp,
             outputs='image',
             live=True).launch()```

Screenshot

https://user-images.githubusercontent.com/26504141/189708738-7d752762-98e9-413f-9259-a224510bde92.mp4

Logs


Hint: Set streaming=True for Sketchpad component to use live streaming.
Running on local URL:  http://127.0.0.1:7861

To create a public link, set `share=True` in `launch()`.

(basically nothing special)

System Info

Gradio: 3.3
OS: Windows 10
Browser: Chrome (latest)

Severity

blocking all usage of gradio

xenova avatar Sep 12 '22 16:09 xenova

@pngwn can you take a look?

aliabid94 avatar Sep 13 '22 01:09 aliabid94

same issue

Zhengxinyang avatar Oct 26 '22 10:10 Zhengxinyang

same issue

widium avatar Jan 10 '23 15:01 widium

It looks like this is fixed now as a result of PR #3277 (thanks @pngwn)

Btw @xenova you can also do something like this:

import gradio as gr
from PIL import Image

def predict(img):
    return Image.new('L', (256, 256))

sp = gr.Sketchpad(shape=(400, 400))

gr.Interface(fn=predict,
             inputs=sp,
             outputs='image',
             live=True).launch()

Which produces a nicer looking UI.

abidlabs avatar Feb 23 '23 14:02 abidlabs

Great! Thanks 😃

xenova avatar Feb 23 '23 15:02 xenova