jens commited on
Commit
2d1b836
·
1 Parent(s): 8235071

colour according to mask

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -82,10 +82,12 @@ with block:
82
  color = red if point_label_radio == 0 else blue
83
  img = np.array(input_image)
84
  cv2.circle(img, (x, y), 5, color, -1)
85
- img = Image.fromarray(img)
86
  point_coords.append([x,y])
87
  point_labels.append(point_label_radio)
88
  generated_mask, _, _ = sam.cond_pred(pts=np.array(point_coords), lbls=np.array(point_labels))
 
 
 
89
  return [ img,
90
  unedited_image,
91
  img,
 
82
  color = red if point_label_radio == 0 else blue
83
  img = np.array(input_image)
84
  cv2.circle(img, (x, y), 5, color, -1)
 
85
  point_coords.append([x,y])
86
  point_labels.append(point_label_radio)
87
  generated_mask, _, _ = sam.cond_pred(pts=np.array(point_coords), lbls=np.array(point_labels))
88
+ img[generated_mask] = (1.0, 0.0, 0.0)
89
+ img = Image.fromarray(img)
90
+
91
  return [ img,
92
  unedited_image,
93
  img,