Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ processor = CLIPSegProcessor.from_pretrained("CIDAS/clipseg-rd64-refined")
|
|
10 |
model = CLIPSegForImageSegmentation.from_pretrained("CIDAS/clipseg-rd64-refined")
|
11 |
|
12 |
|
13 |
-
def process_image(image, prompt):
|
14 |
inputs = processor(
|
15 |
text=prompt, images=image, padding="max_length", return_tensors="pt"
|
16 |
)
|
@@ -45,7 +45,7 @@ def get_masks(prompts, img, threhsold):
|
|
45 |
prompts = prompts.split(",")
|
46 |
masks = []
|
47 |
for prompt in prompts:
|
48 |
-
mask = process_image(img, prompt)
|
49 |
mask = mask > threhsold
|
50 |
masks.append(mask)
|
51 |
return masks
|
|
|
10 |
model = CLIPSegForImageSegmentation.from_pretrained("CIDAS/clipseg-rd64-refined")
|
11 |
|
12 |
|
13 |
+
def process_image(image, prompt, threhsold):
|
14 |
inputs = processor(
|
15 |
text=prompt, images=image, padding="max_length", return_tensors="pt"
|
16 |
)
|
|
|
45 |
prompts = prompts.split(",")
|
46 |
masks = []
|
47 |
for prompt in prompts:
|
48 |
+
mask = process_image(img, prompt, threhsold)
|
49 |
mask = mask > threhsold
|
50 |
masks.append(mask)
|
51 |
return masks
|