Added conditioning image masking to xy_grid.

Use `True` and `False` to select values.
This commit is contained in:
random_thoughtss 2022-10-25 12:20:54 -07:00
parent f9549d1cbb
commit 605d27687f
2 changed files with 4 additions and 1 deletions

View File

@ -770,7 +770,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
conditioning_mask = conditioning_mask.to(image.device)
conditioning_image = image
if shared.opts.inpainting_mask_image:
if getattr(self, "inpainting_mask_image", shared.opts.inpainting_mask_image):
conditioning_image = conditioning_image * (1.0 - conditioning_mask)
conditioning_image = self.sd_model.get_first_stage_encoding(self.sd_model.encode_first_stage(conditioning_image))

View File

@ -153,6 +153,8 @@ def str_permutations(x):
"""dummy function for specifying it in AxisOption's type when you want to get a list of permutations"""
return x
def str_to_bool(x):
return "true" in x.lower().strip()
AxisOption = namedtuple("AxisOption", ["label", "type", "apply", "format_value", "confirm"])
AxisOptionImg2Img = namedtuple("AxisOptionImg2Img", ["label", "type", "apply", "format_value", "confirm"])
@ -178,6 +180,7 @@ axis_options = [
AxisOption("Eta", float, apply_field("eta"), format_value_add_label, None),
AxisOption("Clip skip", int, apply_clip_skip, format_value_add_label, None),
AxisOption("Denoising", float, apply_field("denoising_strength"), format_value_add_label, None),
AxisOption("Mask Conditioning Image", str_to_bool, apply_field("inpainting_mask_image"), format_value_add_label, None),
]