Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -222,12 +222,14 @@ def prod_function(app, prod_path, webcam_path):
|
|
222 |
|
223 |
webcam_emb = app.get(cv2_webcam, max_num=1)
|
224 |
webcam_emb = webcam_emb[0].embedding
|
|
|
225 |
|
226 |
similarity_score = []
|
227 |
for path in prod_path:
|
228 |
img = cv2.imread(path)
|
229 |
face_embedding = app.get(img, max_num=1)
|
230 |
face_embedding = face_embedding[0].embedding
|
|
|
231 |
|
232 |
similarity_score.append(F.cosine_similarity(face_embedding,webcam_emb, dim=0))
|
233 |
#distance = F.pairwise_distance(emb, emb_prod)
|
|
|
222 |
|
223 |
webcam_emb = app.get(cv2_webcam, max_num=1)
|
224 |
webcam_emb = webcam_emb[0].embedding
|
225 |
+
webcam_emb = torch.from_numpy(np.array(webcam_emb))
|
226 |
|
227 |
similarity_score = []
|
228 |
for path in prod_path:
|
229 |
img = cv2.imread(path)
|
230 |
face_embedding = app.get(img, max_num=1)
|
231 |
face_embedding = face_embedding[0].embedding
|
232 |
+
face_embedding = torch.from_numpy(np.array(face_embedding))
|
233 |
|
234 |
similarity_score.append(F.cosine_similarity(face_embedding,webcam_emb, dim=0))
|
235 |
#distance = F.pairwise_distance(emb, emb_prod)
|