Mrahsanahmad commited on
Commit
f0cc5ec
1 Parent(s): 41c10f1
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -79,7 +79,10 @@ with gr.Blocks() as demo:
79
  color = np.concatenate([np.random.random(3), np.array([1.0])], axis=0)
80
  h, w = mask.shape[-2:]
81
  mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
82
- mask_images.append(mask_image)
 
 
 
83
 
84
  return np.stack(mask_images)
85
 
 
79
  color = np.concatenate([np.random.random(3), np.array([1.0])], axis=0)
80
  h, w = mask.shape[-2:]
81
  mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
82
+ np_img = mask_image;
83
+ np_img = np.squeeze(np_img, axis=2) # axis=2 is channel dimension
84
+ pil_img = Image.fromarray(np_img, 'RGB')
85
+ mask_images.append(pil_img)
86
 
87
  return np.stack(mask_images)
88