Update app.py
Browse files
app.py
CHANGED
@@ -65,12 +65,13 @@ def extract_image(img, pos_prompts, neg_prompts, threshold, alpha_value=0.5):
|
|
65 |
|
66 |
# apply the final_mask as alpha channel on the output image
|
67 |
output_image[:, :, :3] = img_np[:, :, :3]
|
68 |
-
output_image[:, :, 3] = (final_mask *
|
69 |
|
70 |
# convert the output_image back to a PIL.Image object
|
71 |
output_image = Image.fromarray(output_image, "RGBA")
|
72 |
|
73 |
-
return output_image, final_mask, bmask
|
|
|
74 |
|
75 |
|
76 |
|
|
|
65 |
|
66 |
# apply the final_mask as alpha channel on the output image
|
67 |
output_image[:, :, :3] = img_np[:, :, :3]
|
68 |
+
output_image[:, :, 3] = (final_mask * alpha_value * 255).astype(np.uint8)
|
69 |
|
70 |
# convert the output_image back to a PIL.Image object
|
71 |
output_image = Image.fromarray(output_image, "RGBA")
|
72 |
|
73 |
+
return output_image, final_mask.astype(np.uint8), bmask
|
74 |
+
|
75 |
|
76 |
|
77 |
|