diff --git a/javascript/amethyst-nightfall.css b/javascript/amethyst-nightfall.css
index d0e61ee23..950d593b2 100644
--- a/javascript/amethyst-nightfall.css
+++ b/javascript/amethyst-nightfall.css
@@ -117,7 +117,6 @@ svg.feather.feather-image, .feather .feather-image { display: none }
#txt2img_subseed_row { padding: 0; margin-top: 16px; }
#txt2img_subseed_show, #img2img_subseed_show { display: None }
#txt2img_subseed_strength { margin-top: 0; }
-#txtimg_hr_finalres { max-width: 200px; }
#pnginfo_html2_info { margin-top: -18px; background-color: var(--input-background-fill); padding: var(--input-padding) }
#txt2img_tools > div > button, #img2img_tools > div > button { filter: hue-rotate(180deg) saturate(0.5); }
#txt2img_tools, #img2img_tools { margin-top: -4px; margin-bottom: -4px; }
diff --git a/javascript/black-orange.css b/javascript/black-orange.css
index 71bf1abcf..a4a1ace2c 100644
--- a/javascript/black-orange.css
+++ b/javascript/black-orange.css
@@ -111,7 +111,6 @@ svg.feather.feather-image, .feather .feather-image { display: none }
#txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); }
#txt2img_results, #img2img_results, #extras_results { background-color: var(--background-color); padding: 0; }
#txt2img_settings { min-width: var(--left-column); max-width: var(--left-column); background-color: #111111; padding-top: 16px; }
-#txtimg_hr_finalres { max-width: 200px; }
#pnginfo_html2_info { margin-top: -18px; background-color: var(--input-background-fill); padding: var(--input-padding) }
#txt2img_tools > div > button, #img2img_tools > div > button { filter: hue-rotate(180deg) saturate(0.5); }
#txt2img_tools, #img2img_tools { margin-top: -4px; margin-bottom: -4px; }
diff --git a/javascript/style.css b/javascript/style.css
index 1a90ee377..16ea5f13a 100644
--- a/javascript/style.css
+++ b/javascript/style.css
@@ -57,49 +57,17 @@ button.custom-button{
.theme-preview { display: none; position: fixed; border: 4px solid var(--neutral-600); box-shadow: 2px 2px 2px 2px var(--neutral-700); top: 0; bottom: 0; left: 0; right: 0; margin: auto; max-width: 75vw; z-index: 999; }
/* txt2img/img2img specific */
-.block.token-counter{
- position: absolute;
- display: inline-block;
- right: 1em;
- min-width: 0 !important;
- width: auto;
- z-index: 100;
- top: -0.75em;
-}
-
-.block.token-counter span{
- background: var(--input-background-fill) !important;
- box-shadow: 0 0 0.0 0.3em rgba(192,192,192,0.15), inset 0 0 0.6em rgba(192,192,192,0.075);
- border: 2px solid rgba(192,192,192,0.4) !important;
-}
-
-.block.token-counter.error span{
- box-shadow: 0 0 0.0 0.3em rgba(255,0,0,0.15), inset 0 0 0.6em rgba(255,0,0,0.075);
- border: 2px solid rgba(255,0,0,0.4) !important;
-}
-
+.block.token-counter{ position: absolute; display: inline-block; right: 1em; min-width: 0 !important; width: auto; z-index: 100; top: -0.75em; }
+.block.token-counter span{ background: var(--input-background-fill) !important; box-shadow: 0 0 0.0 0.3em rgba(192,192,192,0.15), inset 0 0 0.6em rgba(192,192,192,0.075); border: 2px solid rgba(192,192,192,0.4) !important; }
+.block.token-counter.error span{ box-shadow: 0 0 0.0 0.3em rgba(255,0,0,0.15), inset 0 0 0.6em rgba(255,0,0,0.075); border: 2px solid rgba(255,0,0,0.4) !important; }
.block.token-counter div{ display: inline; }
.block.token-counter span{ padding: 0.1em 0.75em; }
-
-[id$=_subseed_show]{
- min-width: auto !important;
- flex-grow: 0 !important;
- display: flex;
-}
-
-[id$=_subseed_show] label{
- margin-bottom: 0.5em;
- align-self: end;
-}
-
+[id$=_subseed_show]{ min-width: auto !important; flex-grow: 0 !important; display: flex; }
+[id$=_subseed_show] label{ margin-bottom: 0.5em; align-self: end; }
.performance { font-size: 0.85em; color: #444; }
.performance p { display: inline-block; color: var(--body-text-color-subdued) !important }
.performance .time { margin-right: 0; }
-
-@media screen and (min-width: 2500px) {
- #txt2img_gallery, #img2img_gallery { min-height: 768px; }
-}
-
+@media screen and (min-width: 2500px) { #txt2img_gallery, #img2img_gallery { min-height: 768px; } }
#txt2img_gallery img, #img2img_gallery img, #extras_gallery img { object-fit: scale-down; width: -webkit-fill-available !important; }
#txt2img_footer, #img2img_footer, #extras_footer { height: fit-content; }
#txt2img_footer, #img2img_footer { height: fit-content; display: none; }
@@ -110,79 +78,21 @@ button.custom-button{
#txt2img_generate_line2 > button, #img2img_generate_line2 > button, #extras_generate_box > button { height: 2.2em; line-height: 0; min-width: unset; display: block !important; }
#txt2img_tools > div, #img2img_tools > div { justify-content: space-around; margin-top: 0.5em; margin-bottom: 0em; }
#txt2img_tools > div > button, #img2img_tools > div > button { scale: 120%; }
-
-.interrogate-col{
- min-width: 0 !important;
- max-width: fit-content;
- gap: 0.5em;
-}
-.interrogate-col > button{
- flex: 1;
-}
-
+.interrogate-col{ min-width: 0 !important; max-width: fit-content; gap: 0.5em; }
+.interrogate-col > button{ flex: 1; }
#img2img_copy_to_img2img { margin-bottom: 2em; }
-
-#txtimg_hr_finalres{
- min-height: 0 !important;
- padding: .625rem .75rem;
- margin-left: -0.75em
-}
-
-#img2img_scale_resolution_preview.block{
- display: flex;
- align-items: end;
-}
-
-#txtimg_hr_finalres .resolution, #img2img_scale_resolution_preview .resolution{
- font-weight: bold;
-}
-
-div#extras_scale_to_tab div.form{
- flex-direction: row;
-}
-
-#img2img_unused_scale_by_slider {
- visibility: hidden;
- width: 0.5em;
- max-width: 0.5em;
- min-width: 0.5em;
-}
-
-.inactive{
- opacity: 0.5;
-}
-
-div.dimensions-tools {
- min-width: 0 !important;
- max-width: fit-content;
- flex-direction: row;
- align-content: center;
-}
-
-div#extras_scale_to_tab div.form{
- flex-direction: row;
-}
-
-#mode_img2img .gradio-image > div.fixed-height, #mode_img2img .gradio-image > div.fixed-height img{
- height: 480px !important;
- max-height: 480px !important;
- min-height: 480px !important;
-}
-
-#img2img_sketch, #img2maskimg, #inpaint_sketch {
- overflow: overlay !important;
- resize: auto;
- background: var(--panel-background-fill);
- z-index: 5;
-}
-
-.image-buttons button{
- min-width: auto;
-}
-
-.infotext {
- overflow-wrap: break-word;
-}
+#txtimg_hr_finalres{ min-height: 0 !important; padding: .625rem .75rem; margin-left: -0.75em }
+#img2img_scale_resolution_preview.block{ display: flex; align-items: end; }
+#txtimg_hr_finalres .resolution, #img2img_scale_resolution_preview .resolution{ font-weight: bold; }
+div#extras_scale_to_tab div.form{ flex-direction: row; }
+#img2img_unused_scale_by_slider { visibility: hidden; width: 0.5em; max-width: 0.5em; min-width: 0.5em; }
+.inactive{ opacity: 0.5; }
+div.dimensions-tools { min-width: 0 !important; max-width: fit-content; flex-direction: row; align-content: center; }
+div#extras_scale_to_tab div.form{ flex-direction: row; }
+#mode_img2img .gradio-image > div.fixed-height, #mode_img2img .gradio-image > div.fixed-height img{ height: 480px !important; max-height: 480px !important; min-height: 480px !important; }
+#img2img_sketch, #img2maskimg, #inpaint_sketch { overflow: overlay !important; resize: auto; background: var(--panel-background-fill); z-index: 5; }
+.image-buttons button{ min-width: auto; }
+.infotext { overflow-wrap: break-word; }
.tooltip {
display: block;
@@ -201,125 +111,34 @@ div#extras_scale_to_tab div.form{
opacity: 0;
z-index: var(--layer-2);
}
-
-.tooltip-show {
- opacity: 0.9;
-}
+.tooltip-show { opacity: 0.9; }
/* settings */
#quicksettings { width: fit-content; align-items: end; }
#quicksettings > div, #quicksettings > fieldset{ max-width: 20em; min-width: 24em; padding: 0; border: none; box-shadow: none; background: none; }
#quicksettings > button { margin-left: -0.5em; }
-#settings{
- display: flex;
- flex-flow: row wrap;
- gap: var(--layout-gap);
-}
-
-#settings div {
- border: none;
-}
-
-#settings > div.tab-content {
- flex: 100000 0 75%;
-}
-
-#settings > div.tab-content > div {
- border: none;
- padding: 0;
-}
-
-#settings > div.tab-nav {
- display: grid;
- grid-template-columns: repeat(auto-fill, .3em minmax(10em, 1fr));
- flex: 1 0 auto;
- width: 12em;
- align-self: flex-start;
- gap: var(--spacing-md);
-}
-
-#settings > div.tab-nav button{
- display: block;
- border: none;
- text-align: left;
- white-space: initial;
- padding: 0;
-}
-
-#settings > div.tab-nav > #settings_show_all_pages {
- padding: var(--size-2) var(--size-4);
-}
-
-#settings .block.gradio-checkbox {
- margin: 0;
- width: auto;
-}
-
-#settings .dirtyable {
- display: grid;
- grid-template-columns: .3em auto;
- gap: .5em;
-}
-
-#settings .dirtyable.hidden {
- display: none;
-}
-
-#settings .modification-indicator {
- width: 100%;
- height: 100%;
- border-radius: 1em !important;
- padding: 0;
-}
-
-#settings .modification-indicator:disabled {
- visibility: hidden;
-}
-
-#settings .modification-indicator.unsaved {
- background: var(--color-accent-soft);
-}
-
-#settings .modification-indicator.changed {
- background: var(--color-accent);
-}
-
-#settings .modification-indicator.changed.unsaved {
- background-image: linear-gradient(var(--color-accent) 25%, var(--color-accent-soft) 75%);
-}
-
-#settings_result{
- margin: 0 1.2em;
-}
-
+#settings { display: flex; flex-flow: row wrap; gap: var(--layout-gap); }
+#settings div { border: none; }
+#settings > div.tab-content { flex: 100000 0 75%; }
+#settings > div.tab-content > div { border: none; padding: 0; }
+#settings > div.tab-nav { display: grid; grid-template-columns: repeat(auto-fill, .3em minmax(10em, 1fr)); flex: 1 0 auto; width: 12em; align-self: flex-start; gap: var(--spacing-md); }
+#settings > div.tab-nav button { display: block; border: none; text-align: left; white-space: initial; padding: 0; }
+#settings > div.tab-nav > #settings_show_all_pages { padding: var(--size-2) var(--size-4); }
+#settings .block.gradio-checkbox { margin: 0; width: auto; }
+#settings .dirtyable { display: grid; grid-template-columns: .3em auto; gap: .5em; }
+#settings .dirtyable.hidden { display: none; }
+#settings .modification-indicator { width: 100%; height: 100%; border-radius: 1em !important; padding: 0; }
+#settings .modification-indicator:disabled { visibility: hidden; }
+#settings .modification-indicator.unsaved { background: var(--color-accent-soft); }
+#settings .modification-indicator.changed { background: var(--color-accent); }
+#settings .modification-indicator.changed.unsaved { background-image: linear-gradient(var(--color-accent) 25%, var(--color-accent-soft) 75%); }
+#settings_result { margin: 0 1.2em; }
/* live preview */
-.progressDiv{
- position: relative;
- height: 20px;
- background: #b4c0cc;
- margin-bottom: -3px;
-}
-
-.dark .progressDiv{
- background: #424c5b;
-}
-
-.progressDiv .progress{
- width: 0%;
- height: 20px;
- background: #0060df;
- color: white;
- font-weight: bold;
- line-height: 20px;
- padding: 0 8px 0 0;
- text-align: right;
- overflow: visible;
- white-space: nowrap;
- padding: 0 0.5em;
-}
-
+.progressDiv{ position: relative; height: 20px; background: #b4c0cc; margin-bottom: -3px; }
+.dark .progressDiv{ background: #424c5b; }
+.progressDiv .progress{ width: 0%; height: 20px; background: #0060df; color: white; font-weight: bold; line-height: 20px; padding: 0 8px 0 0; text-align: right; overflow: visible; white-space: nowrap; padding: 0 0.5em; }
.livePreview { position: absolute; z-index: 300; background-color: transparent; width: -webkit-fill-available; }
.livePreview img { position: absolute; object-fit: contain; width: 100%; height: 100%; }
.dark .livePreview { background-color: rgb(17 24 39 / var(--tw-bg-opacity)); }
@@ -356,19 +175,8 @@ div#extras_scale_to_tab div.form{
.lightboxModalPreviewZone:focus-visible { outline: none; }
.lightboxModalPreviewZone > img { display: block; margin: auto; width: auto; }
.lightboxModalPreviewZone > img.modalImageFullscreen{ object-fit: contain; height: 100%; width: 100%; min-height: 0; background: transparent; }
-
-table.settings-value-table{
- background: white;
- border-collapse: collapse;
- margin: 1em;
- border: 4px solid white;
-}
-
-table.settings-value-table td{
- padding: 0.4em;
- border: 1px solid #ccc;
- max-width: 36em;
-}
+table.settings-value-table { background: white; border-collapse: collapse; margin: 1em; border: 4px solid white; }
+table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-width: 36em; }
.modalPrev, .modalNext {
cursor: pointer;
@@ -389,53 +197,15 @@ table.settings-value-table td{
-webkit-user-select: none;
}
-.modalNext {
- right: 0;
-}
-
-.modalPrev:hover, .modalNext:hover {
- background-color: rgba(0, 0, 0, 0.8);
-}
-
-#imageARPreview {
- position: absolute;
- top: 0px;
- left: 0px;
- border: 2px solid red;
- background: rgba(255, 0, 0, 0.3);
- z-index: 900;
- pointer-events: none;
- display: none;
-}
+.modalNext { right: 0; }
+.modalPrev:hover, .modalNext:hover { background-color: rgba(0, 0, 0, 0.8); }
+#imageARPreview { position: absolute; top: 0px; left: 0px; border: 2px solid red; background: rgba(255, 0, 0, 0.3); z-index: 900; pointer-events: none; display: none; }
/* context menu (ie for the generate button) */
-
-#context-menu{
- z-index:9999;
- position:absolute;
- display:block;
- padding:0px 0;
- border:2px solid #a55000;
- box-shadow:1px 1px 2px #CE6400;
- width: 200px;
-}
-
-.context-menu-items{
- list-style: none;
- margin: 0;
- padding: 0;
-}
-
-.context-menu-items a{
- display:block;
- padding:5px;
- cursor:pointer;
-}
-
-.context-menu-items a:hover{
- background: #a55000;
-}
-
+#context-menu { z-index:9999; position:absolute; display:block; padding:0px 0; border:2px solid #a55000; box-shadow:1px 1px 2px #CE6400; width: 200px; }
+.context-menu-items{ list-style: none; margin: 0; padding: 0; }
+.context-menu-items a { display:block; padding:5px; cursor:pointer; }
+.context-menu-items a:hover { background: #a55000; }
/* extensions */
#tab_extensions table{ border-collapse: collapse; }
@@ -499,9 +269,7 @@ div.controlnet_main_options { display: grid; grid-template-columns: 1fr 1fr; gri
.log-monitor td, .log-monitor th { padding-left: 1em; }
/* Workaround for Gradio dropdowns capturing clicks during and after fadeout */
-.gradio-dropdown > label > div > div:first-child:not(.showOptions) ~ ul.options {
- pointer-events: none;
-}
+.gradio-dropdown > label > div > div:first-child:not(.showOptions) ~ ul.options { pointer-events: none; }
.splash { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 100; display: block; text-align: center; }
.splash-img { margin: 10% auto 0 auto; width: 512px; background-repeat: no-repeat; height: 512px; animation: move 5s infinite alternate; }
@@ -518,4 +286,4 @@ div.controlnet_main_options { display: grid; grid-template-columns: 1fr 1fr; gri
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
-}
\ No newline at end of file
+}
diff --git a/modules/processing.py b/modules/processing.py
index afbe18e67..d553d82fe 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -840,54 +840,52 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
self.height = self.height or 512
def init_hr(self):
- if self.enable_hr:
- self.ops.append('hires')
- if shared.opts.use_old_hires_fix_width_height and self.applied_old_hires_behavior_to != (self.width, self.height):
- self.hr_resize_x = self.width
- self.hr_resize_y = self.height
- self.hr_upscale_to_x = self.width
- self.hr_upscale_to_y = self.height
- self.width, self.height = old_hires_fix_first_pass_dimensions(self.width, self.height)
- self.applied_old_hires_behavior_to = (self.width, self.height)
- if self.hr_resize_x == 0 and self.hr_resize_y == 0:
- self.extra_generation_params["Hires upscale"] = self.hr_scale
- self.hr_upscale_to_x = int(self.width * self.hr_scale)
- self.hr_upscale_to_y = int(self.height * self.hr_scale)
+ if shared.opts.use_old_hires_fix_width_height and self.applied_old_hires_behavior_to != (self.width, self.height):
+ self.hr_resize_x = self.width
+ self.hr_resize_y = self.height
+ self.hr_upscale_to_x = self.width
+ self.hr_upscale_to_y = self.height
+ self.width, self.height = old_hires_fix_first_pass_dimensions(self.width, self.height)
+ self.applied_old_hires_behavior_to = (self.width, self.height)
+ if self.hr_resize_x == 0 and self.hr_resize_y == 0:
+ self.extra_generation_params["Hires upscale"] = self.hr_scale
+ self.hr_upscale_to_x = int(self.width * self.hr_scale)
+ self.hr_upscale_to_y = int(self.height * self.hr_scale)
+ else:
+ self.extra_generation_params["Hires resize"] = f"{self.hr_resize_x}x{self.hr_resize_y}"
+ if self.hr_resize_y == 0:
+ self.hr_upscale_to_x = self.hr_resize_x
+ self.hr_upscale_to_y = self.hr_resize_x * self.height // self.width
+ elif self.hr_resize_x == 0:
+ self.hr_upscale_to_x = self.hr_resize_y * self.width // self.height
+ self.hr_upscale_to_y = self.hr_resize_y
else:
- self.extra_generation_params["Hires resize"] = f"{self.hr_resize_x}x{self.hr_resize_y}"
- if self.hr_resize_y == 0:
+ target_w = self.hr_resize_x
+ target_h = self.hr_resize_y
+ src_ratio = self.width / self.height
+ dst_ratio = self.hr_resize_x / self.hr_resize_y
+ if src_ratio < dst_ratio:
self.hr_upscale_to_x = self.hr_resize_x
self.hr_upscale_to_y = self.hr_resize_x * self.height // self.width
- elif self.hr_resize_x == 0:
+ else:
self.hr_upscale_to_x = self.hr_resize_y * self.width // self.height
self.hr_upscale_to_y = self.hr_resize_y
- else:
- target_w = self.hr_resize_x
- target_h = self.hr_resize_y
- src_ratio = self.width / self.height
- dst_ratio = self.hr_resize_x / self.hr_resize_y
- if src_ratio < dst_ratio:
- self.hr_upscale_to_x = self.hr_resize_x
- self.hr_upscale_to_y = self.hr_resize_x * self.height // self.width
- else:
- self.hr_upscale_to_x = self.hr_resize_y * self.width // self.height
- self.hr_upscale_to_y = self.hr_resize_y
- self.truncate_x = (self.hr_upscale_to_x - target_w) // opt_f
- self.truncate_y = (self.hr_upscale_to_y - target_h) // opt_f
- # special case: the user has chosen to do nothing
- if self.hr_upscale_to_x == self.width and self.hr_upscale_to_y == self.height:
- self.extra_generation_params.pop("Hires upscale", None)
- self.extra_generation_params.pop("Hires resize", None)
- return
- if not shared.state.processing_has_refined_job_count:
- if shared.state.job_count == -1:
- shared.state.job_count = self.n_iter
- shared.state.job_count = shared.state.job_count * 2
- shared.state.processing_has_refined_job_count = True
- if self.hr_second_pass_steps:
- self.extra_generation_params["Hires steps"] = self.hr_second_pass_steps
- if self.hr_upscaler is not None:
- self.extra_generation_params["Hires upscaler"] = self.hr_upscaler
+ self.truncate_x = (self.hr_upscale_to_x - target_w) // opt_f
+ self.truncate_y = (self.hr_upscale_to_y - target_h) // opt_f
+ # special case: the user has chosen to do nothing
+ if self.hr_upscale_to_x == self.width and self.hr_upscale_to_y == self.height:
+ self.extra_generation_params.pop("Hires upscale", None)
+ self.extra_generation_params.pop("Hires resize", None)
+ return
+ if not shared.state.processing_has_refined_job_count:
+ if shared.state.job_count == -1:
+ shared.state.job_count = self.n_iter
+ shared.state.job_count = shared.state.job_count * 2
+ shared.state.processing_has_refined_job_count = True
+ if self.hr_second_pass_steps:
+ self.extra_generation_params["Hires steps"] = self.hr_second_pass_steps
+ if self.hr_upscaler is not None:
+ self.extra_generation_params["Hires upscaler"] = self.hr_upscaler
def sample(self, conditioning, unconditional_conditioning, seeds, subseeds, subseed_strength, prompts):
@@ -922,6 +920,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
return samples
self.is_hr_pass = True
self.init_hr()
+ self.ops.append('hires')
target_width = self.hr_upscale_to_x
target_height = self.hr_upscale_to_y
diff --git a/modules/ui.py b/modules/ui.py
index b082b5066..a8ff78468 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -13,7 +13,7 @@ from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, wrap_grad
from modules import sd_hijack, sd_models, script_callbacks, ui_extensions, deepbooru, extra_networks, ui_common, ui_postprocessing, ui_loadsave, ui_train, ui_models
from modules.ui_components import FormRow, FormColumn, FormGroup, ToolButton, FormHTML # pylint: disable=unused-import
from modules.paths import script_path, data_path
-from modules.shared import opts, cmd_opts
+from modules.shared import opts, cmd_opts, readfile
from modules import prompt_parser
import modules.codeformer_model
import modules.generation_parameters_copypaste as parameters_copypaste
@@ -86,12 +86,14 @@ def add_style(name: str, prompt: str, negative_prompt: str):
def calc_resolution_hires(enable, width, height, hr_scale, hr_resize_x, hr_resize_y):
+ print('HERE', enable, width, height, hr_scale, hr_resize_x, hr_resize_y)
from modules import processing, devices
if not enable:
return ""
if modules.shared.backend == modules.shared.Backend.DIFFUSERS:
return "Hires resize: disabled"
p = processing.StableDiffusionProcessingTxt2Img(width=width, height=height, enable_hr=True, hr_scale=hr_scale, hr_resize_x=hr_resize_x, hr_resize_y=hr_resize_y)
+ p.init_hr()
with devices.autocast():
p.init([""], [0], [0])
return f"Hires resize: from {p.width}x{p.height} to {p.hr_resize_x or p.hr_upscale_to_x}x{p.hr_resize_y or p.hr_upscale_to_y}"
@@ -334,6 +336,7 @@ def create_ui(startup_timer = None):
startup_timer = timer.Timer()
reload_javascript()
parameters_copypaste.reset()
+ ui_defaults = readfile(cmd_opts.ui_config)
import modules.txt2img # pylint: disable=redefined-outer-name
modules.scripts.scripts_current = modules.scripts.scripts_txt2img
@@ -356,10 +359,10 @@ def create_ui(startup_timer = None):
res_switch_btn = ToolButton(value=switch_values_symbol, elem_id="txt2img_res_switch_btn", label="Switch dims")
with FormRow(elem_classes="checkboxes-row", variant="compact"):
- show_batch = gr.Checkbox(label='Batch', value=True, elem_id="txt2img_show_batch")
- show_seed = gr.Checkbox(label='Seed', value=False, elem_id="txt2img_show_seed")
- show_advanced = gr.Checkbox(label='Advanced', value=False, elem_id="txt2img_show_advanced")
- show_second_pass = gr.Checkbox(label='Second pass', value=False, elem_id="txt2img_show_second_pass")
+ show_batch = gr.Checkbox(label='Batch', value=ui_defaults.get('txt2img/Batch/value', True), elem_id="txt2img_show_batch")
+ show_seed = gr.Checkbox(label='Seed details', value=ui_defaults.get('txt2img/Seed details/value', False), elem_id="txt2img_show_seed")
+ show_advanced = gr.Checkbox(label='Advanced', value=ui_defaults.get('txt2img/Advanced/value', False), elem_id="txt2img_show_advanced")
+ show_second_pass = gr.Checkbox(label='Second pass', value=ui_defaults.get('txt2img/Second pass/value', False), elem_id="txt2img_show_second_pass")
with FormGroup(visible=show_batch.value, elem_id="txt2img_batch") as batch_group:
with FormRow(elem_id="txt2img_row_batch"):
@@ -377,11 +380,11 @@ def create_ui(startup_timer = None):
restore_faces = gr.Checkbox(label='Face restore', value=False, visible=len(modules.shared.face_restorers) > 1, elem_id="txt2img_restore_faces")
tiling = gr.Checkbox(label='Tiling', value=False, elem_id="txt2img_tiling")
- with FormGroup(visible=show_second_pass.value, elem_id="txt2img_second_pass") as second_pass:
+ with FormGroup(visible=show_second_pass.value, elem_id="txt2img_second_pass") as second_pass_group:
hr_second_pass_steps, latent_index = create_sampler_and_steps_selection(modules.sd_samplers.samplers, "txt2img", False)
with FormRow(elem_id="txt2img_hires_fix_row1", variant="compact"):
denoising_strength = gr.Slider(minimum=0.05, maximum=1.0, step=0.01, label='Denoising strength', value=0.3, elem_id="txt2img_denoising_strength")
- with FormRow():
+ with FormRow(elem_id="txt2img_hires_finalres", variant="compact"):
hr_final_resolution = FormHTML(value="", elem_id="txtimg_hr_finalres", label="Upscaled resolution", interactive=False)
with FormRow(elem_id="txt2img_hires_fix_row2", variant="compact"):
hr_upscaler = gr.Dropdown(label="Upscaler", elem_id="txt2img_hr_upscaler", choices=[*modules.shared.latent_upscale_modes, *[x.name for x in modules.shared.sd_upscalers]], value=modules.shared.latent_upscale_default_mode)
@@ -460,7 +463,7 @@ def create_ui(startup_timer = None):
res_switch_btn.click(lambda w, h: (h, w), inputs=[width, height], outputs=[width, height], show_progress=False)
batch_switch_btn.click(lambda w, h: (h, w), inputs=[batch_count, batch_size], outputs=[batch_count, batch_size], show_progress=False)
txt_prompt_img.change(fn=modules.images.image_data, inputs=[txt_prompt_img], outputs=[txt2img_prompt, txt_prompt_img])
- show_second_pass.change(enable_hr_change, inputs=[show_second_pass], outputs=[second_pass, hr_refiner], show_progress = False)
+ show_second_pass.change(enable_hr_change, inputs=[show_second_pass], outputs=[second_pass_group, hr_refiner], show_progress = False)
show_seed.change(gr_show, inputs=[show_seed], outputs=[seed_group], show_progress = False)
show_batch.change(gr_show, inputs=[show_batch], outputs=[batch_group], show_progress = False)
show_advanced.change(gr_show, inputs=[show_advanced], outputs=[advanced_group], show_progress = False)
@@ -483,8 +486,8 @@ def create_ui(startup_timer = None):
(seed_resize_from_w, "Seed resize from-1"),
(seed_resize_from_h, "Seed resize from-2"),
(denoising_strength, "Denoising strength"),
- (second_pass, lambda d: "Denoising strength" in d),
- (second_pass, lambda d: gr.Row.update(visible="Denoising strength" in d)),
+ (show_second_pass, lambda d: "Denoising strength" in d),
+ (show_second_pass, lambda d: gr.Row.update(visible="Denoising strength" in d)),
(hr_scale, "Hires upscale"),
(hr_upscaler, "Hires upscaler"),
(hr_second_pass_steps, "Hires steps"),
@@ -589,11 +592,11 @@ def create_ui(startup_timer = None):
steps, sampler_index = create_sampler_and_steps_selection(modules.sd_samplers.samplers_for_img2img, "img2img", True)
with FormRow(elem_classes="checkboxes-row", variant="compact"):
- show_seed = gr.Checkbox(label='Seed', value=False, elem_id="img2img_show_seed")
- show_resize = gr.Checkbox(label='Resize', value=False, elem_id="img2img_show_resize")
- show_batch = gr.Checkbox(label='Batch', value=False, elem_id="img2img_show_batch")
- show_denoise = gr.Checkbox(label='Denoise', value=True, elem_id="img2img_show_denoise")
- show_advanced = gr.Checkbox(label='Advanced', value=False, elem_id="txt2img_show_advanced")
+ show_seed = gr.Checkbox(label='Seed details', value=ui_defaults.get('img2img/Seed details/value', False), elem_id="img2img_show_seed")
+ show_resize = gr.Checkbox(label='Resize', value=ui_defaults.get('img2img/Resize/value', False), elem_id="img2img_show_resize")
+ show_batch = gr.Checkbox(label='Batch', value=ui_defaults.get('img2img/Batch/value', False), elem_id="img2img_show_batch")
+ show_denoise = gr.Checkbox(label='Denoise', value=ui_defaults.get('img2img/Denoise/value', True), elem_id="img2img_show_denoise")
+ show_advanced = gr.Checkbox(label='Advanced', value=ui_defaults.get('img2img/Advanced/value', False), elem_id="txt2img_show_advanced")
with FormGroup(visible=show_resize.value, elem_id=f"{tab}_resize_group") as resize_group:
with FormRow():