Spaces:
Running
Running
Update cal_compatibility.py
Browse files- cal_compatibility.py +4 -3
cal_compatibility.py
CHANGED
@@ -17,6 +17,7 @@ def cosine_similarity(vector1, vector2):
|
|
17 |
norm_vector2 = np.linalg.norm(flat_vector2)
|
18 |
return dot_product / (norm_vector1 * norm_vector2)
|
19 |
|
|
|
20 |
def cal_compatibility():
|
21 |
n = 4096
|
22 |
access_feature = []
|
@@ -24,7 +25,7 @@ def cal_compatibility():
|
|
24 |
for item_id in range(1, 9):
|
25 |
access_feature.append(vgg16.extract_features('downloads/access_' + '%s.jpg' % item_id)[0])
|
26 |
for item_id in range(1, 7):
|
27 |
-
cloth_feature.append(vgg16.extract_features('downloads/
|
28 |
|
29 |
best_score = float('-inf')
|
30 |
best_cloth = 0
|
@@ -37,5 +38,5 @@ def cal_compatibility():
|
|
37 |
best_cloth = j
|
38 |
best_access = i
|
39 |
print(best_cloth, best_access)
|
40 |
-
picture = [f"downloads/
|
41 |
-
return picture
|
|
|
17 |
norm_vector2 = np.linalg.norm(flat_vector2)
|
18 |
return dot_product / (norm_vector1 * norm_vector2)
|
19 |
|
20 |
+
|
21 |
def cal_compatibility():
|
22 |
n = 4096
|
23 |
access_feature = []
|
|
|
25 |
for item_id in range(1, 9):
|
26 |
access_feature.append(vgg16.extract_features('downloads/access_' + '%s.jpg' % item_id)[0])
|
27 |
for item_id in range(1, 7):
|
28 |
+
cloth_feature.append(vgg16.extract_features('downloads/cloth_' + '%s.jpeg' % item_id)[0])
|
29 |
|
30 |
best_score = float('-inf')
|
31 |
best_cloth = 0
|
|
|
38 |
best_cloth = j
|
39 |
best_access = i
|
40 |
print(best_cloth, best_access)
|
41 |
+
picture = [f"downloads/cloth_{best_cloth}.jpeg", f"downloads/access_{best_access}.jpg"]
|
42 |
+
return picture
|