Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,9 @@ class SamAutomaticMaskGenerator:
|
|
16 |
self.sam_pipeline = sam_pipeline
|
17 |
|
18 |
def generate(self, image_rgb):
|
19 |
-
|
|
|
|
|
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 |
|