Spaces:
Build error
Build error
jhj0517
commited on
Commit
•
a34578b
1
Parent(s):
e96c999
initial commit
Browse files- modules/sam.py +10 -8
modules/sam.py
CHANGED
@@ -54,11 +54,13 @@ class SamInference:
|
|
54 |
'min_mask_region_area': int(params[5]),
|
55 |
}
|
56 |
|
57 |
-
|
58 |
-
self.tunable_params
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
54 |
'min_mask_region_area': int(params[5]),
|
55 |
}
|
56 |
|
57 |
+
try:
|
58 |
+
if self.model is None or self.mask_generator is None or self.tunable_params != tunable_params:
|
59 |
+
self.tunable_params = tunable_params
|
60 |
+
self.set_mask_generator()
|
61 |
+
masks = self.mask_generator.generate(image)
|
62 |
+
combined_image = create_mask_combined_images(image, masks)
|
63 |
+
gallery = create_mask_gallery(image, masks)
|
64 |
+
return [combined_image] + gallery
|
65 |
+
except Exception as e:
|
66 |
+
print(e)
|