solve some of issues with img2img copy to tab functionality

This commit is contained in:
AUTOMATIC1111 2024-01-27 11:12:59 +03:00
parent 67285e3478
commit 9dd3b2a10b
4 changed files with 7 additions and 10 deletions

View File

@ -109,7 +109,7 @@ def check_versions():
expected_torch_version = "2.1.2"
expected_xformers_version = "0.0.23.post1"
expected_gradio_version = "4.13.0"
expected_gradio_version = "4.16.0"
if version.parse(torch.__version__) < version.parse(expected_torch_version):
print_error_explanation(f"""

View File

@ -544,7 +544,7 @@ def create_ui():
add_copy_image_controls('sketch', sketch)
with gr.TabItem('Inpaint', id='inpaint', elem_id="img2img_inpaint_tab") as tab_inpaint:
init_img_with_mask = gr.ImageEditor(label="Image for inpainting with mask", show_label=False, elem_id="img2maskimg", brush=Brush(colors=["opts.img2img_inpaint_mask_brush_color"], color_mode="fixed"), interactive=True, type="pil", image_mode="RGBA")
init_img_with_mask = gr.ImageEditor(label="Image for inpainting with mask", show_label=False, elem_id="img2maskimg", brush=Brush(colors=[opts.img2img_inpaint_mask_brush_color], color_mode="fixed"), interactive=True, type="pil", image_mode="RGBA")
add_copy_image_controls('inpaint', init_img_with_mask)
with gr.TabItem('Inpaint sketch', id='inpaint_sketch', elem_id="img2img_inpaint_sketch_tab") as tab_inpaint_color:
@ -580,6 +580,9 @@ def create_ui():
if isinstance(img, dict) and 'image' in img:
return img['image']
if isinstance(img, dict) and 'composite' in img:
return img['composite']
return img
for button, name, elem in copy_image_buttons:
@ -695,12 +698,6 @@ def create_ui():
if category not in {"accordions"}:
scripts.scripts_img2img.setup_ui_for_section(category)
# the code below is meant to update the resolution label after the image in the image selection UI has changed.
# as it is now the event keeps firing continuously for inpaint edits, which ruins the page with constant requests.
# I assume this must be a gradio bug and for now we'll just do it for non-inpaint inputs.
for component in [init_img, sketch]:
component.change(fn=lambda: None, _js="updateImg2imgResizeToTextAfterChangingImage", inputs=[], outputs=[], show_progress=False)
def select_img2img_tab(tab):
return gr.update(visible=tab in [2, 3, 4]), gr.update(visible=tab == 3),

View File

@ -7,7 +7,7 @@ clean-fid
einops
facexlib
fastapi>=0.90.1
gradio==4.13.0
gradio==4.16.0
inflection
jsonmerge
kornia

View File

@ -6,7 +6,7 @@ clean-fid==0.1.35
einops==0.4.1
facexlib==0.3.0
fastapi==0.104.1
gradio==4.13.0
gradio==4.16.0
httpcore==0.15
inflection==0.5.1
jsonmerge==1.8.0