Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,8 +18,6 @@ model, preprocess = clip.load("ViT-B/32")
|
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
model.to(device).eval()
|
20 |
|
21 |
-
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
22 |
-
# model, preprocess = clip.load("ViT-B/32", device=device)
|
23 |
|
24 |
def find_similarity(base64_image, text_input):
|
25 |
try:
|
@@ -54,7 +52,7 @@ def segment_image(input_image, text_input):
|
|
54 |
image_bytes = base64.b64decode(input_image)
|
55 |
image = Image.open(BytesIO(image_bytes))
|
56 |
|
57 |
-
image = cv2.cvtColor(np.array(image), cv2.COLOR_BGR2RGB)
|
58 |
mask_generator = SamAutomaticMaskGenerator(sam)
|
59 |
masks = mask_generator.generate(image)
|
60 |
|
|
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
model.to(device).eval()
|
20 |
|
|
|
|
|
21 |
|
22 |
def find_similarity(base64_image, text_input):
|
23 |
try:
|
|
|
52 |
image_bytes = base64.b64decode(input_image)
|
53 |
image = Image.open(BytesIO(image_bytes))
|
54 |
|
55 |
+
#image = cv2.cvtColor(np.array(image), cv2.COLOR_BGR2RGB)
|
56 |
mask_generator = SamAutomaticMaskGenerator(sam)
|
57 |
masks = mask_generator.generate(image)
|
58 |
|