Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -106,7 +106,7 @@ def get_image_embedding(image_path):
|
|
| 106 |
# Print the actual embedding dimension
|
| 107 |
print(f"Image embedding shape: {image_embedding.shape}")
|
| 108 |
|
| 109 |
-
|
| 110 |
if len(image_embedding) == 384:
|
| 111 |
return image_embedding.tolist()
|
| 112 |
|
|
@@ -121,7 +121,12 @@ def get_image_embedding(image_path):
|
|
| 121 |
# CASE 3: Embedding is smaller than 384 → Apply Padding ❌
|
| 122 |
else:
|
| 123 |
padding = np.zeros(384 - len(image_embedding)) # Create padding vector
|
| 124 |
-
image_embedding = np.concatenate((image_embedding, padding)) # Append padding
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
return image_embedding.tolist()
|
| 127 |
|
|
|
|
| 106 |
# Print the actual embedding dimension
|
| 107 |
print(f"Image embedding shape: {image_embedding.shape}")
|
| 108 |
|
| 109 |
+
""" # CASE 1: Embedding is already 384-dimensional ✅
|
| 110 |
if len(image_embedding) == 384:
|
| 111 |
return image_embedding.tolist()
|
| 112 |
|
|
|
|
| 121 |
# CASE 3: Embedding is smaller than 384 → Apply Padding ❌
|
| 122 |
else:
|
| 123 |
padding = np.zeros(384 - len(image_embedding)) # Create padding vector
|
| 124 |
+
image_embedding = np.concatenate((image_embedding, padding)) # Append padding"""
|
| 125 |
+
# Truncate to 384 dimensions
|
| 126 |
+
image_embedding = image_embedding[:384]
|
| 127 |
+
|
| 128 |
+
# Print the final embedding shape
|
| 129 |
+
print(f"Final Image embedding shape: {image_embedding.shape}")
|
| 130 |
|
| 131 |
return image_embedding.tolist()
|
| 132 |
|