mirror of
https://github.com/nod-ai/AMD-SHARK-Studio.git
synced 2026-04-03 03:00:17 -04:00
Fix outpainting params (#1089)
This commit is contained in:
@@ -157,8 +157,8 @@ def outpaint_inf(
|
||||
prompt,
|
||||
negative_prompt,
|
||||
image,
|
||||
args.pixels,
|
||||
args.mask_blur,
|
||||
pixels,
|
||||
mask_blur,
|
||||
left,
|
||||
right,
|
||||
top,
|
||||
|
||||
@@ -69,11 +69,13 @@ class OutpaintPipeline(StableDiffusionPipeline):
|
||||
latents = latents * self.scheduler.init_noise_sigma
|
||||
return latents
|
||||
|
||||
def prepare_mask_and_masked_image(self, image, mask, mask_blur):
|
||||
def prepare_mask_and_masked_image(
|
||||
self, image, mask, mask_blur, width, height
|
||||
):
|
||||
if mask_blur > 0:
|
||||
mask = mask.filter(ImageFilter.GaussianBlur(mask_blur))
|
||||
image = image.resize((512, 512))
|
||||
mask = mask.resize((512, 512))
|
||||
image = image.resize((width, height))
|
||||
mask = mask.resize((width, height))
|
||||
|
||||
# preprocess image
|
||||
if isinstance(image, (Image.Image, np.ndarray)):
|
||||
@@ -478,7 +480,7 @@ class OutpaintPipeline(StableDiffusionPipeline):
|
||||
|
||||
# Preprocess mask and image
|
||||
mask, masked_image = self.prepare_mask_and_masked_image(
|
||||
image_to_process, mask_to_process, mask_blur
|
||||
image_to_process, mask_to_process, mask_blur, width, height
|
||||
)
|
||||
|
||||
# Prepare mask latent variables
|
||||
|
||||
@@ -61,6 +61,7 @@ p.add_argument(
|
||||
"--height",
|
||||
type=int,
|
||||
default=512,
|
||||
choices=range(384, 768, 8),
|
||||
help="the height of the output image.",
|
||||
)
|
||||
|
||||
@@ -68,6 +69,7 @@ p.add_argument(
|
||||
"--width",
|
||||
type=int,
|
||||
default=512,
|
||||
choices=range(384, 768, 8),
|
||||
help="the width of the output image.",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user