Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
22 |
-
print(fg.max(),
|
23 |
print("***********Inference finish****************")
|
24 |
# print("***********MASK****************", inp_np.max(), mask.max())
|
25 |
-
fg = np.dstack((fg,
|
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]
|