Spaces:
Running
on
Zero
Running
on
Zero
zhiweili
commited on
Commit
•
1e8ce82
1
Parent(s):
50e8483
gray input image
Browse files
app_masked.py
CHANGED
@@ -48,12 +48,15 @@ def image_to_image(
|
|
48 |
time_cost_str = ''
|
49 |
run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
|
50 |
|
|
|
|
|
|
|
51 |
generator = torch.Generator(device=DEVICE).manual_seed(seed)
|
52 |
generated_image = basepipeline(
|
53 |
generator=generator,
|
54 |
prompt=edit_prompt,
|
55 |
negative_prompt=DEFAULT_NEGATIVE_PROMPT,
|
56 |
-
original_image=
|
57 |
mask=mask_image,
|
58 |
guidance_scale=guidance_scale,
|
59 |
num_inference_steps=num_steps,
|
|
|
48 |
time_cost_str = ''
|
49 |
run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
|
50 |
|
51 |
+
gray_image = input_image.convert("L")
|
52 |
+
gray_image = Image.merge("RGB", (gray_image, gray_image, gray_image))
|
53 |
+
|
54 |
generator = torch.Generator(device=DEVICE).manual_seed(seed)
|
55 |
generated_image = basepipeline(
|
56 |
generator=generator,
|
57 |
prompt=edit_prompt,
|
58 |
negative_prompt=DEFAULT_NEGATIVE_PROMPT,
|
59 |
+
original_image=gray_image,
|
60 |
mask=mask_image,
|
61 |
guidance_scale=guidance_scale,
|
62 |
num_inference_steps=num_steps,
|
pipelines/masked_stable_diffusion_xl_img2img.py
CHANGED
@@ -213,7 +213,7 @@ class MaskedStableDiffusionXLImg2ImgPipeline(StableDiffusionXLImg2ImgPipeline):
|
|
213 |
if pil_mask.mode != "L":
|
214 |
pil_mask = pil_mask.convert("L")
|
215 |
mask_blur = self.blur_mask(pil_mask, blur)
|
216 |
-
mask_compose = self.blur_mask(
|
217 |
if original_image is None:
|
218 |
original_image = image
|
219 |
if prompt is not None and isinstance(prompt, str):
|
|
|
213 |
if pil_mask.mode != "L":
|
214 |
pil_mask = pil_mask.convert("L")
|
215 |
mask_blur = self.blur_mask(pil_mask, blur)
|
216 |
+
mask_compose = self.blur_mask(pil_mask, blur_compose)
|
217 |
if original_image is None:
|
218 |
original_image = image
|
219 |
if prompt is not None and isinstance(prompt, str):
|