aboutsummaryrefslogtreecommitdiff
path: root/modules/ui.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ui.py')
-rw-r--r--modules/ui.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/modules/ui.py b/modules/ui.py
index 6525676c..5476c32f 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -564,13 +564,13 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
with gr.TabItem('Inpaint', id='inpaint'):
init_img_with_mask = gr.Image(label="Image for inpainting with mask", show_label=False, elem_id="img2maskimg", source="upload", interactive=True, type="pil", tool="sketch", image_mode="RGBA")
- init_img_inpaint = gr.Image(label="Image for img2img", show_label=False, source="upload", interactive=True, type="pil", visible=False)
- init_mask_inpaint = gr.Image(label="Mask", source="upload", interactive=True, type="pil", visible=False)
+ init_img_inpaint = gr.Image(label="Image for img2img", show_label=False, source="upload", interactive=True, type="pil", visible=False, elem_id="img_inpaint_base")
+ init_mask_inpaint = gr.Image(label="Mask", source="upload", interactive=True, type="pil", visible=False, elem_id="img_inpaint_mask")
mask_blur = gr.Slider(label='Mask blur', minimum=0, maximum=64, step=1, value=4)
with gr.Row():
- mask_mode = gr.Radio(label="Mask mode", show_label=False, choices=["Draw mask", "Upload mask"], type="index", value="Draw mask")
+ mask_mode = gr.Radio(label="Mask mode", show_label=False, choices=["Draw mask", "Upload mask"], type="index", value="Draw mask", elem_id="mask_mode")
inpainting_mask_invert = gr.Radio(label='Masking mode', show_label=False, choices=['Inpaint masked', 'Inpaint not masked'], value='Inpaint masked', type="index")
inpainting_fill = gr.Radio(label='Masked content', choices=['fill', 'original', 'latent noise', 'latent nothing'], value='fill', type="index")
@@ -998,6 +998,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
for interface, label, ifid in interfaces:
with gr.TabItem(label, id=ifid):
interface.render()
+
+ if os.path.exists(os.path.join(script_path, "notification.mp3")):
+ audio_notification = gr.Audio(interactive=False, value=os.path.join(script_path, "notification.mp3"), elem_id="audio_notification", visible=False)
text_settings = gr.Textbox(elem_id="settings_json", value=lambda: opts.dumpjson(), visible=False)
settings_submit.click(
@@ -1006,18 +1009,21 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
outputs=[result, text_settings],
)
+ paste_field_names = ['Prompt', 'Negative prompt', 'Steps', 'Face restoration', 'Seed', 'Size-1', 'Size-2']
+ txt2img_fields = [field for field,name in txt2img_paste_fields if name in paste_field_names]
+ img2img_fields = [field for field,name in img2img_paste_fields if name in paste_field_names]
send_to_img2img.click(
- fn=lambda x: (image_from_url_text(x)),
- _js="extract_image_from_gallery_img2img",
- inputs=[txt2img_gallery],
- outputs=[init_img],
+ fn=lambda img, *args: (image_from_url_text(img),*args),
+ _js="(gallery, ...args) => [extract_image_from_gallery_img2img(gallery), ...args]",
+ inputs=[txt2img_gallery] + txt2img_fields,
+ outputs=[init_img] + img2img_fields,
)
send_to_inpaint.click(
- fn=lambda x: (image_from_url_text(x)),
- _js="extract_image_from_gallery_inpaint",
- inputs=[txt2img_gallery],
- outputs=[init_img_with_mask],
+ fn=lambda x, *args: (image_from_url_text(x), *args),
+ _js="(gallery, ...args) => [extract_image_from_gallery_inpaint(gallery), ...args]",
+ inputs=[txt2img_gallery] + txt2img_fields,
+ outputs=[init_img_with_mask] + img2img_fields,
)
img2img_send_to_img2img.click(