Spaces:
Running
on
Zero
Running
on
Zero
NikhilJoson
commited on
Commit
•
9b93b56
1
Parent(s):
b56a98c
Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,8 @@ def gemini_predict(prompt):
|
|
52 |
|
53 |
|
54 |
MAX_SEED = np.iinfo(np.int32).max
|
55 |
-
|
|
|
56 |
|
57 |
|
58 |
###GroundingDINO & SAM Setup
|
@@ -149,7 +150,6 @@ def refine_masks(masks: torch.BoolTensor, polygon_refinement: bool = False) -> L
|
|
149 |
|
150 |
def get_alphacomp_mask(mask, image, random_color=True):
|
151 |
annotated_frame_pil = Image.fromarray(image).convert("RGBA")
|
152 |
-
#mask_image_pil = Image.fromarray((mask_image.cpu().numpy() * 255).astype(np.uint8)).convert("RGBA")
|
153 |
mask_image_pil = Image.fromarray(mask).convert("RGBA")
|
154 |
|
155 |
return np.array(Image.alpha_composite(annotated_frame_pil, mask_image_pil))
|
|
|
52 |
|
53 |
|
54 |
MAX_SEED = np.iinfo(np.int32).max
|
55 |
+
SAM_device = "cuda" # or "cpu"
|
56 |
+
DEVICE = "cuda"
|
57 |
|
58 |
|
59 |
###GroundingDINO & SAM Setup
|
|
|
150 |
|
151 |
def get_alphacomp_mask(mask, image, random_color=True):
|
152 |
annotated_frame_pil = Image.fromarray(image).convert("RGBA")
|
|
|
153 |
mask_image_pil = Image.fromarray(mask).convert("RGBA")
|
154 |
|
155 |
return np.array(Image.alpha_composite(annotated_frame_pil, mask_image_pil))
|