Spaces:
Running
on
Zero
Running
on
Zero
zhiweili
commited on
Commit
•
23086f0
1
Parent(s):
1e8ce82
change base model
Browse files
app_masked.py
CHANGED
@@ -12,7 +12,7 @@ from diffusers import (
|
|
12 |
DiffusionPipeline,
|
13 |
)
|
14 |
|
15 |
-
BASE_MODEL = "
|
16 |
|
17 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
18 |
|
@@ -48,15 +48,12 @@ 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 |
-
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=
|
60 |
mask=mask_image,
|
61 |
guidance_scale=guidance_scale,
|
62 |
num_inference_steps=num_steps,
|
|
|
12 |
DiffusionPipeline,
|
13 |
)
|
14 |
|
15 |
+
BASE_MODEL = "RunDiffusion/Juggernaut-XL-v9"
|
16 |
|
17 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
18 |
|
|
|
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=input_image,
|
57 |
mask=mask_image,
|
58 |
guidance_scale=guidance_scale,
|
59 |
num_inference_steps=num_steps,
|
pipelines/masked_stable_diffusion_xl_img2img.py
CHANGED
@@ -214,6 +214,8 @@ class MaskedStableDiffusionXLImg2ImgPipeline(StableDiffusionXLImg2ImgPipeline):
|
|
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):
|
|
|
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 |
+
mask_compose = (mask_blur + mask_compose) / 2
|
218 |
+
|
219 |
if original_image is None:
|
220 |
original_image = image
|
221 |
if prompt is not None and isinstance(prompt, str):
|