OriLib commited on
Commit
4f7b85b
·
verified ·
1 Parent(s): 7650b57

Update example_inference.py

Browse files
Files changed (1) hide show
  1. example_inference.py +3 -3
example_inference.py CHANGED
@@ -28,10 +28,10 @@ def example_inference():
28
  result_image = postprocess_image(result[0][0], orig_im_size)
29
 
30
  # save result
31
- pil_im = Image.fromarray(result_image)
32
- no_bg_image = Image.new("RGBA", pil_im.size, (0,0,0,0))
33
  orig_image = Image.open(im_path)
34
- no_bg_image.paste(orig_image, mask=pil_im)
 
35
  no_bg_image.save("example_image_no_bg.png")
36
 
37
 
 
28
  result_image = postprocess_image(result[0][0], orig_im_size)
29
 
30
  # save result
31
+ pil_mask_im = Image.fromarray(result_image)
 
32
  orig_image = Image.open(im_path)
33
+ no_bg_image = orig_image.copy()
34
+ no_bg_image.putalpha(pil_mask_im)
35
  no_bg_image.save("example_image_no_bg.png")
36
 
37