aryswisnu commited on
Commit
fa45949
1 Parent(s): 3166f93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -67,10 +67,13 @@ def extract_image(img, pos_prompts, neg_prompts, threshold, alpha_value=0.5):
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
 
 
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, final_mask, and bmask back to PIL.Image objects
71
  output_image = Image.fromarray(output_image, "RGBA")
72
+ final_mask = Image.fromarray((final_mask * 255).astype(np.uint8), "L")
73
+ bmask = Image.fromarray((bmask * 255).astype(np.uint8), "L")
74
+
75
+ return output_image, final_mask, bmask
76
 
 
77
 
78
 
79