Redmind commited on
Commit
13de781
·
verified ·
1 Parent(s): b471940

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -112,8 +112,11 @@ def get_image_embedding(image_path):
112
 
113
  # CASE 2: Embedding is larger than 384 (e.g., 512) → Apply PCA ✅
114
  elif len(image_embedding) > 384:
115
- pca = PCA(n_components=384)
 
116
  image_embedding = pca.fit_transform(image_embedding.reshape(1, -1)).flatten()
 
 
117
 
118
  # CASE 3: Embedding is smaller than 384 → Apply Padding ❌
119
  else:
 
112
 
113
  # CASE 2: Embedding is larger than 384 (e.g., 512) → Apply PCA ✅
114
  elif len(image_embedding) > 384:
115
+
116
+ pca = PCA(n_components=384, svd_solver='auto') # Auto solver for stability
117
  image_embedding = pca.fit_transform(image_embedding.reshape(1, -1)).flatten()
118
+ print(f"Reduced image embedding shape: {image_embedding.shape}")
119
+
120
 
121
  # CASE 3: Embedding is smaller than 384 → Apply Padding ❌
122
  else: