Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ def Get_Densefeature(image, candidate_labels):
|
|
68 |
|
69 |
with torch.no_grad():
|
70 |
dense_image_feature = model.get_image_dense_features(image_input)
|
71 |
-
captions = candidate_labels
|
72 |
caption_input = torch.tensor(tokenizer(captions, max_length=77, padding="max_length", truncation=True).input_ids, dtype=torch.long, device=device)
|
73 |
text_feature = model.get_text_features(caption_input,walk_short_pos=True)
|
74 |
text_feature = text_feature / text_feature.norm(p=2, dim=-1, keepdim=True)
|
|
|
68 |
|
69 |
with torch.no_grad():
|
70 |
dense_image_feature = model.get_image_dense_features(image_input)
|
71 |
+
captions = [candidate_labels[0]]
|
72 |
caption_input = torch.tensor(tokenizer(captions, max_length=77, padding="max_length", truncation=True).input_ids, dtype=torch.long, device=device)
|
73 |
text_feature = model.get_text_features(caption_input,walk_short_pos=True)
|
74 |
text_feature = text_feature / text_feature.norm(p=2, dim=-1, keepdim=True)
|