Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -71,11 +71,11 @@ def predict(text,img):
|
|
71 |
top_N_images.append(l[index])
|
72 |
return scores,top_N_images
|
73 |
|
74 |
-
search_query = text
|
75 |
|
76 |
with torch.no_grad():
|
77 |
# Encode and normalize the description using CLIP
|
78 |
-
text_encoded = model.encode_text(clip.tokenize(
|
79 |
text_encoded /= text_encoded.norm(dim=-1, keepdim=True)
|
80 |
|
81 |
similarity = text_encoded.cpu().numpy() @ image_features.cpu().numpy().T
|
|
|
71 |
top_N_images.append(l[index])
|
72 |
return scores,top_N_images
|
73 |
|
74 |
+
#search_query = text
|
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
|