Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -75,7 +75,7 @@ def predict(text,img):
|
|
75 |
|
76 |
with torch.no_grad():
|
77 |
# Encode and normalize the description using CLIP
|
78 |
-
text_encoded = model.encode_text(clip.tokenize(text).to(device))
|
79 |
text_encoded /= text_encoded.norm(dim=-1, keepdim=True)
|
80 |
|
81 |
similarity = text_encoded.cpu().numpy() @ image_features.cpu().numpy().T
|
|
|
75 |
|
76 |
with torch.no_grad():
|
77 |
# Encode and normalize the description using CLIP
|
78 |
+
text_encoded = model.encode_text(clip.tokenize([text]).to(device))
|
79 |
text_encoded /= text_encoded.norm(dim=-1, keepdim=True)
|
80 |
|
81 |
similarity = text_encoded.cpu().numpy() @ image_features.cpu().numpy().T
|