Mrahsanahmad commited on
Commit
05e5a06
1 Parent(s): 5bc486f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -59,14 +59,14 @@ with gr.Blocks() as demo:
59
  def generate_mask(image):
60
  outputs = generator(image, points_per_batch=256)
61
  mask_images = []
62
- for mask in outputs["masks"]:
63
- color = np.concatenate([np.random.random(3), np.array([1.0])], axis=0)
64
- h, w = mask.shape[-2:]
65
- mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
66
- np_img = mask_image;
67
- np_img = np.squeeze(np_img, axis=2) # axis=2 is channel dimension
68
- pil_img = Image.fromarray(np_img, 'RGB')
69
- mask_images.append(pil_img)
70
 
71
  #return np.stack(mask_images)
72
  return image
 
59
  def generate_mask(image):
60
  outputs = generator(image, points_per_batch=256)
61
  mask_images = []
62
+ #for mask in outputs["masks"]:
63
+ # color = np.concatenate([np.random.random(3), np.array([1.0])], axis=0)
64
+ # h, w = mask.shape[-2:]
65
+ # mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
66
+ # np_img = mask_image;
67
+ # np_img = np.squeeze(np_img, axis=2) # axis=2 is channel dimension
68
+ # pil_img = Image.fromarray(np_img, 'RGB')
69
+ # mask_images.append(pil_img)
70
 
71
  #return np.stack(mask_images)
72
  return image