-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Unable to update properties of Image #5019
Comments
Hi @4a454646 ! Sorry about the confusion but we intentionally don't support updating the shape of |
Interesting, it would be great to have that clarified on the Gradio documentation. I have been on an absolute journey trying to get this functionality, and discovered several bugs in the process. My first thought after trying that was to instead manually resize the image with pillow. So I tried that, using the following code:
And that actually works for a regular image. HOWEVER, my goal is to resize a sketch image. Once I add the parameter
And of course I can't modify My next idea was to have two image boxes, one for the upload, and one for the resized image to sketch on. Using the
However, this breaks something about
has the same result, so long as I have wasted an entire day trying to figure this out. My only goal is to downscale the image proportionally after upload, so that I can sketch on it without lagging. |
Hi @4a454646 this should now be possible on I've modified your original example a little bit: import gradio as gr
def welcome():
return gr.Image(shape=(100,100), tool="sketch")
with gr.Blocks() as demo:
image = gr.Image(label="Background", source='upload', type="pil", interactive=True)
image.upload(welcome, None, image)
demo.queue().launch() |
requires fix of gradio-app/gradio#5019, which is available from 3.45.0, but 3.50.2 is also compatible
Describe the bug
Certain properties of a
gr.Image
cannot be updated with thegr.update()
function. These include parameters like thetool
andshape
of anImage
, which should be able to be changed: update is supposed to "[take] as parameters any of the constructor parameters for that component."Have you searched existing issues? 🔎
Reproduction
Logs
Severity
I can work around it
The text was updated successfully, but these errors were encountered: