Spaces:
Runtime error
Runtime error
File size: 346 Bytes
952a07a |
1 2 3 4 5 6 7 8 9 |
import os
def calculate_similarity():
image_features = embeddings[ModalityType.VISION]
text_features = embeddings[ModalityType.TEXT]
image_features /= image_features.norm(dim=-1, keepdim=True)
text_features /= text_features.norm(dim=-1, keepdim=True)
similarity = text_features.cpu().numpy() @ image_features.cpu().numpy().T |