From 6b55dd5248fd07f55ffefbf9be369b439b239502 Mon Sep 17 00:00:00 2001 From: Ashen Date: Sun, 2 Apr 2023 04:22:41 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9Bfix=20for=20gradio=203.23=20Image?= =?UTF-8?q?=20placement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- scripts/two_shot.py | 2 +- style.css | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e558a6..ba3b8b8 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,8 @@ For bugfix related modifications, see https://github.com/ashen-sensored/gradio/t ## Issues -- ~~The extension's mask color sketching function does not work well with chrome(extreme stuttering) due to gradio's Image component bug.~~ See prerequisite above. This fix is no longer suitable for latest webui version at 22bcc7be, with gradio dependency upgraded to 3.23. Please keep the browser scaling at 100% to avoid the bug. +- ~~The extension's mask color sketching function does not work well with chrome(extreme stuttering) due to gradio's Image component bug.~~ Please keep the browser scaling at 100% while creating blank canvas to avoid the bug. +See prerequisite above. The fix is no longer suitable for latest webui version at 22bcc7be, with gradio dependency upgraded to 3.23. ## Credits diff --git a/scripts/two_shot.py b/scripts/two_shot.py index 060bf0c..f15d814 100644 --- a/scripts/two_shot.py +++ b/scripts/two_shot.py @@ -395,7 +395,7 @@ def update_mask_denoise_flag(flag): mask_denoise_checkbox.change(fn=update_mask_denoise_flag, inputs=[mask_denoise_checkbox], outputs=None) canvas_image = gr.Image(source='upload', mirror_webcam=False, type='numpy', tool='color-sketch', - elem_id='twoshot_canvas_sketch', interactive=True).style(height=400) + elem_id='twoshot_canvas_sketch', interactive=True).style(height=480) # aspect = gr.Radio(["square", "horizontal", "vertical"], value="square", label="Aspect Ratio", # visible=False if is_shared_ui else True) button_run = gr.Button("I've finished my sketch", elem_id="main_button", interactive=True) diff --git a/style.css b/style.css index 2a92bb1..dedeb79 100644 --- a/style.css +++ b/style.css @@ -28,3 +28,9 @@ justify-content: center; align-items: center; } + +#script_twoshot_tabs .gradio-image > div.fixed-height, #script_twoshot_tabs .gradio-image > div.fixed-height img { + height: 480px !important; + max-height: 480px !important; + min-height: 480px !important; +}