Update app.py
Browse files
app.py
CHANGED
|
@@ -25,6 +25,10 @@ def compute_similarity(image, text):
|
|
| 25 |
image_embeds = model.get_image_features(**image_inputs)
|
| 26 |
text_embeds = model.get_text_features(**text_inputs)
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# Normalize embeddings
|
| 29 |
image_embeds = F.normalize(image_embeds, p=2, dim=-1)
|
| 30 |
text_embeds = F.normalize(text_embeds, p=2, dim=-1)
|
|
@@ -43,4 +47,4 @@ demo = gr.Interface(
|
|
| 43 |
description="Upload an image and enter a text prompt to get the similarity score."
|
| 44 |
)
|
| 45 |
|
| 46 |
-
demo.launch()
|
|
|
|
| 25 |
image_embeds = model.get_image_features(**image_inputs)
|
| 26 |
text_embeds = model.get_text_features(**text_inputs)
|
| 27 |
|
| 28 |
+
# Print to debug
|
| 29 |
+
print("Image Embedding:", image_embeds)
|
| 30 |
+
print("Text Embedding:", text_embeds)
|
| 31 |
+
|
| 32 |
# Normalize embeddings
|
| 33 |
image_embeds = F.normalize(image_embeds, p=2, dim=-1)
|
| 34 |
text_embeds = F.normalize(text_embeds, p=2, dim=-1)
|
|
|
|
| 47 |
description="Upload an image and enter a text prompt to get the similarity score."
|
| 48 |
)
|
| 49 |
|
| 50 |
+
demo.launch()
|