befozg commited on
Commit
37ae518
1 Parent(s): 2d7bc49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -18,11 +18,11 @@ def predict(inp):
18
  mask = inference_img(model, inp)
19
  inp_np = np.array(inp)
20
  fg = np.uint8((mask[:,:,None]*inp_np))
21
- mask = (mask > 0.5).astype(np.uint8)
22
- print(fg.max(), mask.max(), fg.shape, mask.shape)
23
  print("***********Inference finish****************")
24
  # print("***********MASK****************", inp_np.max(), mask.max())
25
- fg = np.dstack((fg, mask))
26
  fg_pil = Image.fromarray(fg, 'RGBA')
27
 
28
  return [mask, fg_pil]
 
18
  mask = inference_img(model, inp)
19
  inp_np = np.array(inp)
20
  fg = np.uint8((mask[:,:,None]*inp_np))
21
+ alpha_channel = (mask*255).astype(np.uint8)
22
+ print(fg.max(), alpha_channel.max(), fg.shape, alpha_channel.shape)
23
  print("***********Inference finish****************")
24
  # print("***********MASK****************", inp_np.max(), mask.max())
25
+ fg = np.dstack((fg, alpha_channel))
26
  fg_pil = Image.fromarray(fg, 'RGBA')
27
 
28
  return [mask, fg_pil]