From caf84e8233236cd36fcd42e39e4199262dc3f4e7 Mon Sep 17 00:00:00 2001
From: catboxanon <122327233+catboxanon@users.noreply.github.com>
Date: Wed, 22 Mar 2023 17:51:40 +0000
Subject: Expose inpainting mask and composite
For inpainting, this exposes the mask and masked composite and gives
the user the ability to display these in the web UI,
save to disk, or both.
---
modules/shared.py | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'modules/shared.py')
diff --git a/modules/shared.py b/modules/shared.py
index f28a12cc..d26e9111 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -332,6 +332,8 @@ options_templates.update(options_section(('saving-images', "Saving images/grids"
"save_images_before_face_restoration": OptionInfo(False, "Save a copy of image before doing face restoration."),
"save_images_before_highres_fix": OptionInfo(False, "Save a copy of image before applying highres fix."),
"save_images_before_color_correction": OptionInfo(False, "Save a copy of image before applying color correction to img2img results"),
+ "save_mask": OptionInfo(False, "For inpainting, save a copy of the greyscale mask"),
+ "save_mask_composite": OptionInfo(False, "For inpainting, save a masked composite"),
"jpeg_quality": OptionInfo(80, "Quality for saved jpeg images", gr.Slider, {"minimum": 1, "maximum": 100, "step": 1}),
"webp_lossless": OptionInfo(False, "Use lossless compression for webp images"),
"export_for_4chan": OptionInfo(True, "If the saved image file size is above the limit, or its either width or height are above the limit, save a downscaled copy as JPG"),
@@ -454,6 +456,8 @@ options_templates.update(options_section(('extra_networks', "Extra Networks"), {
options_templates.update(options_section(('ui', "User interface"), {
"return_grid": OptionInfo(True, "Show grid in results for web"),
+ "return_mask": OptionInfo(False, "For inpainting, include the greyscale mask in results for web"),
+ "return_mask_composite": OptionInfo(False, "For inpainting, include masked composite in results for web"),
"do_not_show_images": OptionInfo(False, "Do not show any images in results for web"),
"add_model_hash_to_info": OptionInfo(True, "Add model hash to generation information"),
"add_model_name_to_info": OptionInfo(True, "Add model name to generation information"),
--
cgit v1.2.3
From af2db25c84c9a226ab34959e868fc18740418b4b Mon Sep 17 00:00:00 2001
From: AUTOMATIC <16777216c@gmail.com>
Date: Tue, 21 Mar 2023 08:49:08 +0300
Subject: enable queue by default more stylistic changes
---
modules/shared.py | 3 ++-
modules/ui.py | 4 ++--
modules/ui_extensions.py | 2 +-
style.css | 39 ++++++++++++++++++++++++++++-----------
webui.py | 2 +-
5 files changed, 34 insertions(+), 16 deletions(-)
(limited to 'modules/shared.py')
diff --git a/modules/shared.py b/modules/shared.py
index f28a12cc..0b70d104 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -107,7 +107,8 @@ parser.add_argument("--cors-allow-origins-regex", type=str, help="Allowed CORS o
parser.add_argument("--tls-keyfile", type=str, help="Partially enables TLS, requires --tls-certfile to fully function", default=None)
parser.add_argument("--tls-certfile", type=str, help="Partially enables TLS, requires --tls-keyfile to fully function", default=None)
parser.add_argument("--server-name", type=str, help="Sets hostname of server", default=None)
-parser.add_argument("--gradio-queue", action='store_true', help="Uses gradio queue; experimental option; breaks restart UI button")
+parser.add_argument("--gradio-queue", action='store_true', help="does not do anything", default=True)
+parser.add_argument("--no-gradio-queue", action='store_true', help="Disables gradio queue; causes the webpage to use http requests instead of websockets; was the defaul in earlier versions")
parser.add_argument("--skip-version-check", action='store_true', help="Do not check versions of torch and xformers")
parser.add_argument("--no-hashing", action='store_true', help="disable sha256 hashing of checkpoints to help loading performance", default=False)
parser.add_argument("--no-download-sd-model", action='store_true', help="don't download SD1.5 model even if no model is found in --ckpt-dir", default=False)
diff --git a/modules/ui.py b/modules/ui.py
index c5b0e876..9b9bfa8b 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -478,7 +478,7 @@ def create_ui():
width = gr.Slider(minimum=64, maximum=2048, step=8, label="Width", value=512, elem_id="txt2img_width")
height = gr.Slider(minimum=64, maximum=2048, step=8, label="Height", value=512, elem_id="txt2img_height")
- with gr.Column(elem_id="txt2img_dimensions_row", scale=1):
+ with gr.Column(elem_id="txt2img_dimensions_row", scale=1, elem_classes="dimensions-tools"):
res_switch_btn = ToolButton(value=switch_values_symbol, elem_id="txt2img_res_switch_btn")
if opts.dimensions_and_batch_together:
@@ -758,7 +758,7 @@ def create_ui():
width = gr.Slider(minimum=64, maximum=2048, step=8, label="Width", value=512, elem_id="img2img_width")
height = gr.Slider(minimum=64, maximum=2048, step=8, label="Height", value=512, elem_id="img2img_height")
- with gr.Column(elem_id="img2img_dimensions_row", scale=1):
+ with gr.Column(elem_id="img2img_dimensions_row", scale=1, elem_classes="dimensions-tools"):
res_switch_btn = ToolButton(value=switch_values_symbol, elem_id="img2img_res_switch_btn")
if opts.dimensions_and_batch_together:
diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py
index df75a925..50173e68 100644
--- a/modules/ui_extensions.py
+++ b/modules/ui_extensions.py
@@ -244,7 +244,7 @@ def refresh_available_extensions_from_data(hide_tags, sort_column):
hidden += 1
continue
- install_code = f""""""
+ install_code = f""""""
tags_text = ", ".join([f"{x}" for x in extension_tags])
diff --git a/style.css b/style.css
index 677f03cd..cee13cf7 100644
--- a/style.css
+++ b/style.css
@@ -70,6 +70,15 @@ div.compact{
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
+.gradio-dropdown .wrap-inner.wrap-inner.wrap-inner{
+ flex-wrap: unset;
+}
+
+.gradio-dropdown .single-select{
+ white-space: nowrap;
+ overflow: hidden;
+}
+
.gradio-dropdown .token-remove.remove-all.remove-all{
display: none;
}
@@ -125,6 +134,22 @@ div.gradio-html.min{
min-width: auto;
}
+button.custom-button{
+ border-radius: var(--button-large-radius);
+ padding: var(--button-large-padding);
+ font-weight: var(--button-large-text-weight);
+ border: var(--button-border-width) solid var(--button-secondary-border-color);
+ background: var(--button-secondary-background-fill);
+ color: var(--button-secondary-text-color);
+ font-size: var(--button-large-text-size);
+ display: inline-flex;
+ justify-content: center;
+ align-items: center;
+ transition: var(--button-transition);
+ box-shadow: var(--button-shadow);
+ text-align: center;
+}
+
/* txt2img/img2img specific */
@@ -250,10 +275,11 @@ div.gradio-html.min{
min-width: min(13.5em, 100%) !important;
}
-[id$=_dimensions_row]{
+div.dimensions-tools{
min-width: 0 !important;
max-width: fit-content;
- padding: 0 1em;
+ flex-direction: row;
+ align-content: center;
}
#mode_img2img .gradio-image > div.fixed-height, #mode_img2img .gradio-image > div.fixed-height img{
@@ -281,15 +307,6 @@ div.gradio-html.min{
background: none;
}
-#quicksettings .gradio-dropdown .wrap-inner{
- flex-wrap: unset;
-}
-
-#quicksettings .gradio-dropdown .single-select{
- white-space: nowrap;
- overflow: hidden;
-}
-
#settings{
display: block;
}
diff --git a/webui.py b/webui.py
index aaec79fd..ca725b7d 100644
--- a/webui.py
+++ b/webui.py
@@ -240,7 +240,7 @@ def webui():
shared.demo = modules.ui.create_ui()
startup_timer.record("create ui")
- if cmd_opts.gradio_queue:
+ if not cmd_opts.no_gradio_queue:
shared.demo.queue(64)
gradio_auth_creds = []
--
cgit v1.2.3