-
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
3248 image #3277
3248 image #3277
Conversation
🎉 The demo notebooks match the run.py files! 🎉 |
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-3277-all-demos |
This looks great! Can confirm demo 5d works as expected. For 2c, I think it would be helpful as a visual aid to users to know where the sketchpad starts and stops. Like maybe the component is grayed out outside of the boundaries of the sketchpad? Here's how it currently looks: Here's what I'm proposing (but without hiding the icons): |
Yeah I agree, would a border work? I'm not a huge fan of the grey, looks very sad. |
I like the border approach @pngwn ! |
Did the Can test like this when i push: with gr.Blocks():
gr.Image(source="canvas", tool="color-sketch")
gr.Image(source="canvas", brush_radius=100, tool="color-sketch")
img = gr.Image(source="canvas", interactive=True, tool="color-sketch")
r = gr.Number(20, label="Change brush size", max="100")
btn = gr.Button("Change Brush")
def brushy(size):
print(size)
return img.update(brush_radius=size)
btn.click(brushy, inputs=r, outputs=img) |
Border is even better! |
Brush size thing introduced some bugs will see if i can fix quickly. |
Okay i think we're good. Updated changelog again and fixed bug and added border. This was the brush change btw: Screen.Recording.2023-02-22.at.18.42.55.mov |
Will fix test |
@@ -1398,7 +1399,9 @@ def __init__( | |||
streaming: If True when used in a `live` interface, will automatically stream webcam feed. Only valid is source is 'webcam'. | |||
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles. | |||
mirror_webcam: If True webcam will be mirrored. Default is True. | |||
brush_radius: Size of the brush for Sketch. Default is None which chooses a sensible default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brush_radius: Size of the brush for Sketch. Default is None which chooses a sensible default | |
brush_radius: Size of the brush for sketching (in pixels). Default is None which chooses a sensible default. Only applicable if `tool` is `sketch` or `color-sketch` |
@@ -1398,7 +1399,9 @@ def __init__( | |||
streaming: If True when used in a `live` interface, will automatically stream webcam feed. Only valid is source is 'webcam'. | |||
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles. | |||
mirror_webcam: If True webcam will be mirrored. Default is True. | |||
brush_radius: Size of the brush for Sketch. Default is None which chooses a sensible default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brush_radius: Size of the brush for Sketch. Default is None which chooses a sensible default | |
brush_radius: Size of the brush for sketching (in pixels). Default is None which chooses a sensible default. Only applicable if `tool` is `sketch` or `color-sketch` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and LGTM. Very cool PR @pngwn!
Hey, not sure what's going on but my UI is on Gradio 3.31.0 and this issue still exist, at least for me, same description as other issues, it freezes the addon while loading then it crashes. It happens when I create a new 512,512 canvas with the Two Shot addon |
Could you update to the latest version to see if the issues is still present? If it is could you please create a new issue with a minimal reproduction. |
Description
There was a bug which caused the Sketch to get stuck in a resize loop causing #3248.
Also added support for the shape kwarg on the frontend with sketches. I did look at image uploads too but that requires pretty significant changes, so will leave it for now.
I have added demos to
blocks_mask
.2c
and5d
. They should be testable in the PR preview.Closes #3248. Closes #3166.
Checklist:
A note about the CHANGELOG
Hello 👋 and thank you for contributing to Gradio!
All pull requests must update the change log located in CHANGELOG.md, unless the pull request is labeled with the "no-changelog-update" label.
Please add a brief summary of the change to the Upcoming Release > Full Changelog section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by
[@myusername](link-to-your-github-profile)
in[PR 11111](https://github.com/gradio-app/gradio/pull/11111)
".If you would like to elaborate on your change further, feel free to include a longer explanation in the other sections.
If you would like an image/gif/video showcasing your feature, it may be best to edit the CHANGELOG file using the
GitHub web UI since that lets you upload files directly via drag-and-drop.