fireedman commited on
Commit
f72a933
1 Parent(s): f6a36d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -16,7 +16,9 @@ class SamAutomaticMaskGenerator:
16
  self.sam_pipeline = sam_pipeline
17
 
18
  def generate(self, image_rgb):
19
- outputs = self.sam_pipeline(image_rgb, points_per_batch=32)
 
 
20
  mask = np.array(outputs['masks'], dtype=np.uint8)
21
  return mask
22
 
 
16
  self.sam_pipeline = sam_pipeline
17
 
18
  def generate(self, image_rgb):
19
+ # Convertir el array de NumPy a PIL Image
20
+ image_pil = Image.fromarray(image_rgb)
21
+ outputs = self.sam_pipeline(image_pil, points_per_batch=32)
22
  mask = np.array(outputs['masks'], dtype=np.uint8)
23
  return mask
24