Spaces:
Running
on
A10G
Running
on
A10G
Commit
·
c12df56
1
Parent(s):
b12d9cc
improve mask
Browse files
models.py
CHANGED
|
@@ -238,10 +238,11 @@ def make_inpainting(positive_prompt: str,
|
|
| 238 |
List[Image.Image]: list of generated images
|
| 239 |
"""
|
| 240 |
pipe = get_inpainting_pipeline()
|
|
|
|
| 241 |
|
| 242 |
flush()
|
| 243 |
st.success(f"{pipe.queue_size} images in the queue, can take up to {(pipe.queue_size+1) * 10} seconds")
|
| 244 |
-
|
| 245 |
mask_image=Image.fromarray((mask_image * 255).astype(np.uint8)),
|
| 246 |
prompt=positive_prompt,
|
| 247 |
negative_prompt=negative_prompt,
|
|
@@ -250,6 +251,8 @@ def make_inpainting(positive_prompt: str,
|
|
| 250 |
width=WIDTH,
|
| 251 |
**common_parameters
|
| 252 |
).images[0]
|
|
|
|
|
|
|
| 253 |
return image_
|
| 254 |
|
| 255 |
|
|
|
|
| 238 |
List[Image.Image]: list of generated images
|
| 239 |
"""
|
| 240 |
pipe = get_inpainting_pipeline()
|
| 241 |
+
mask_image_postproc = convolution(mask_image)
|
| 242 |
|
| 243 |
flush()
|
| 244 |
st.success(f"{pipe.queue_size} images in the queue, can take up to {(pipe.queue_size+1) * 10} seconds")
|
| 245 |
+
generated_image = pipe(image=image,
|
| 246 |
mask_image=Image.fromarray((mask_image * 255).astype(np.uint8)),
|
| 247 |
prompt=positive_prompt,
|
| 248 |
negative_prompt=negative_prompt,
|
|
|
|
| 251 |
width=WIDTH,
|
| 252 |
**common_parameters
|
| 253 |
).images[0]
|
| 254 |
+
generated_image = postprocess_image_masking(generated_image, image, mask_image_postproc)
|
| 255 |
+
|
| 256 |
return image_
|
| 257 |
|
| 258 |
|