mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-30 15:10:50 +08:00
compact Soft Inpainting infotext
This commit is contained in:
parent
36fb876da6
commit
9a042c907b
@ -3,6 +3,9 @@ import gradio as gr
|
|||||||
import math
|
import math
|
||||||
from modules.ui_components import InputAccordion
|
from modules.ui_components import InputAccordion
|
||||||
import modules.scripts as scripts
|
import modules.scripts as scripts
|
||||||
|
from modules import infotext_utils
|
||||||
|
|
||||||
|
infotext_utils.register_info_json('Soft Inpainting')
|
||||||
|
|
||||||
|
|
||||||
class SoftInpaintingSettings:
|
class SoftInpaintingSettings:
|
||||||
@ -21,13 +24,14 @@ class SoftInpaintingSettings:
|
|||||||
self.composite_difference_contrast = composite_difference_contrast
|
self.composite_difference_contrast = composite_difference_contrast
|
||||||
|
|
||||||
def add_generation_params(self, dest):
|
def add_generation_params(self, dest):
|
||||||
dest[enabled_gen_param_label] = True
|
dest['Soft Inpainting'] = {
|
||||||
dest[gen_param_labels.mask_blend_power] = self.mask_blend_power
|
'sb': self.mask_blend_power,
|
||||||
dest[gen_param_labels.mask_blend_scale] = self.mask_blend_scale
|
'ps': self.mask_blend_scale,
|
||||||
dest[gen_param_labels.inpaint_detail_preservation] = self.inpaint_detail_preservation
|
'tcb': self.inpaint_detail_preservation,
|
||||||
dest[gen_param_labels.composite_mask_influence] = self.composite_mask_influence
|
'mi': self.composite_mask_influence,
|
||||||
dest[gen_param_labels.composite_difference_threshold] = self.composite_difference_threshold
|
'dt': self.composite_difference_threshold,
|
||||||
dest[gen_param_labels.composite_difference_contrast] = self.composite_difference_contrast
|
'dc': self.composite_difference_contrast,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# ------------------- Methods -------------------
|
# ------------------- Methods -------------------
|
||||||
@ -625,13 +629,21 @@ class Script(scripts.Script):
|
|||||||
- **High values**: Ghosting will be less common, but transitions may be very sudden.
|
- **High values**: Ghosting will be less common, but transitions may be very sudden.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.infotext_fields = [(soft_inpainting_enabled, enabled_gen_param_label),
|
def get_element_value(generation_params: dict, old_key, new_key):
|
||||||
(power, gen_param_labels.mask_blend_power),
|
if 'Soft Inpainting' in generation_params:
|
||||||
(scale, gen_param_labels.mask_blend_scale),
|
return generation_params['Soft Inpainting'].get(new_key, True)
|
||||||
(detail, gen_param_labels.inpaint_detail_preservation),
|
else:
|
||||||
(mask_inf, gen_param_labels.composite_mask_influence),
|
return generation_params.get(old_key)
|
||||||
(dif_thresh, gen_param_labels.composite_difference_threshold),
|
|
||||||
(dif_contr, gen_param_labels.composite_difference_contrast)]
|
self.infotext_fields = [
|
||||||
|
(soft_inpainting_enabled, lambda d: get_element_value(d, enabled_gen_param_label, None)),
|
||||||
|
(power, lambda d: get_element_value(d, gen_param_labels.mask_blend_power, 'sb')),
|
||||||
|
(scale, lambda d: get_element_value(d, gen_param_labels.mask_blend_scale, 'ps')),
|
||||||
|
(detail, lambda d: get_element_value(d, gen_param_labels.inpaint_detail_preservation, 'tcb')),
|
||||||
|
(mask_inf, lambda d: get_element_value(d, gen_param_labels.composite_mask_influence, 'mi')),
|
||||||
|
(dif_thresh, lambda d: get_element_value(d, gen_param_labels.composite_difference_threshold, 'dt')),
|
||||||
|
(dif_contr, lambda d: get_element_value(d, gen_param_labels.composite_difference_contrast, 'dc'))
|
||||||
|
]
|
||||||
|
|
||||||
self.paste_field_names = []
|
self.paste_field_names = []
|
||||||
for _, field_name in self.infotext_fields:
|
for _, field_name in self.infotext_fields:
|
||||||
|
Loading…
Reference in New Issue
Block a user