Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,6 +34,9 @@ def predict(dict, prompt="", negative_prompt="", guidance_scale=7.5, steps=30, s
|
|
| 34 |
|
| 35 |
init_image = dict["image"]
|
| 36 |
mask_image = dict["mask"]
|
|
|
|
|
|
|
|
|
|
| 37 |
mask_image = mask_image.convert("RGBA")
|
| 38 |
data = mask_image.getdata()
|
| 39 |
new_data = []
|
|
@@ -44,7 +47,7 @@ def predict(dict, prompt="", negative_prompt="", guidance_scale=7.5, steps=30, s
|
|
| 44 |
new_data.append(item)
|
| 45 |
|
| 46 |
mask_image.putdata(new_data)
|
| 47 |
-
|
| 48 |
output = pipe(prompt = prompt, negative_prompt=negative_prompt, image=init_image, mask_image=mask_image, guidance_scale=guidance_scale, num_inference_steps=int(steps), strength=strength, clip_skip=1)
|
| 49 |
return output.images[0], gr.update(visible=True)
|
| 50 |
|
|
|
|
| 34 |
|
| 35 |
init_image = dict["image"]
|
| 36 |
mask_image = dict["mask"]
|
| 37 |
+
|
| 38 |
+
width, height = init_image.size
|
| 39 |
+
|
| 40 |
mask_image = mask_image.convert("RGBA")
|
| 41 |
data = mask_image.getdata()
|
| 42 |
new_data = []
|
|
|
|
| 47 |
new_data.append(item)
|
| 48 |
|
| 49 |
mask_image.putdata(new_data)
|
| 50 |
+
mask_image = mask_image.resize(init_image.size, resample=Image.LANCZOS)
|
| 51 |
output = pipe(prompt = prompt, negative_prompt=negative_prompt, image=init_image, mask_image=mask_image, guidance_scale=guidance_scale, num_inference_steps=int(steps), strength=strength, clip_skip=1)
|
| 52 |
return output.images[0], gr.update(visible=True)
|
| 53 |
|