Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,7 @@ def extract_image(pos_prompts, neg_prompts, img, threshold):
|
|
43 |
neg_mask = np.any(np.stack(negative_masks), axis=0)
|
44 |
final_mask = pos_mask & ~neg_mask
|
45 |
|
46 |
-
final_mask = Image.fromarray(final_mask.astype(np.uint8)
|
47 |
output_image = Image.new("RGBA", img.size, (0, 0, 0, 0))
|
48 |
output_image.paste(img, mask=final_mask)
|
49 |
return output_image, final_mask
|
|
|
43 |
neg_mask = np.any(np.stack(negative_masks), axis=0)
|
44 |
final_mask = pos_mask & ~neg_mask
|
45 |
|
46 |
+
final_mask = Image.fromarray((final_mask * 255).astype(np.uint8), "L")
|
47 |
output_image = Image.new("RGBA", img.size, (0, 0, 0, 0))
|
48 |
output_image.paste(img, mask=final_mask)
|
49 |
return output_image, final_mask
|