niulx commited on
Commit
842da73
1 Parent(s): 6e4a4c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -74,6 +74,9 @@ def run_segmentation_wrapper(image):
74
 
75
 
76
  def transparent_paste_with_mask(backimg, foreimg, mask_np,transparency = 128):
 
 
 
77
  backimg_solid_np = np.array(backimg)
78
  bimg = backimg.copy()
79
  fimg = foreimg.copy()
@@ -83,11 +86,8 @@ def transparent_paste_with_mask(backimg, foreimg, mask_np,transparency = 128):
83
  bimg_np = np.array(bimg)
84
  mask_np = mask_np[:,:,np.newaxis]
85
 
86
- try:
87
- new_img_np = bimg_np*mask_np + (1-mask_np)* backimg_solid_np
88
- return Image.fromarray(new_img_np)
89
- except:
90
- import pdb; pdb.set_trace()
91
 
92
  def show_segmentation(image, segmentation, flag):
93
  if flag is False:
 
74
 
75
 
76
  def transparent_paste_with_mask(backimg, foreimg, mask_np,transparency = 128):
77
+ print(type(backimg))
78
+ print(type(foreimg))
79
+ print(type(mask_np))
80
  backimg_solid_np = np.array(backimg)
81
  bimg = backimg.copy()
82
  fimg = foreimg.copy()
 
86
  bimg_np = np.array(bimg)
87
  mask_np = mask_np[:,:,np.newaxis]
88
 
89
+ new_img_np = bimg_np*mask_np + (1-mask_np)* backimg_solid_np
90
+ return Image.fromarray(new_img_np)
 
 
 
91
 
92
  def show_segmentation(image, segmentation, flag):
93
  if flag is False: