Spaces:
Runtime error
Runtime error
small fix
Browse files
pages/2_Concepts_comparison.py
CHANGED
@@ -159,13 +159,13 @@ with output_col_2:
|
|
159 |
header_col_2.write(f'Concepts {", ".join(concept_ids)} - Latent space CLIP')# - Nodes {",".join(list(imp_nodes))}')
|
160 |
|
161 |
edges = []
|
162 |
-
for
|
163 |
-
for
|
164 |
-
if
|
165 |
-
print(f'Similarity between {
|
166 |
-
similarity = cosine_similarity(vectors[
|
167 |
print(np.round(similarity[0][0], 3))
|
168 |
-
edges.append((
|
169 |
|
170 |
# # Create an empty graph
|
171 |
# G = nx.Graph()
|
|
|
159 |
header_col_2.write(f'Concepts {", ".join(concept_ids)} - Latent space CLIP')# - Nodes {",".join(list(imp_nodes))}')
|
160 |
|
161 |
edges = []
|
162 |
+
for c1 in concept_ids:
|
163 |
+
for c2 in concept_ids:
|
164 |
+
if c1 != c2:
|
165 |
+
print(f'Similarity between {c1} and {c2}')
|
166 |
+
similarity = cosine_similarity(vectors[c1].reshape(1, -1), vectors[c2].reshape(1, -1))
|
167 |
print(np.round(similarity[0][0], 3))
|
168 |
+
edges.append((c1, c2, np.round(similarity[0][0], 3)))
|
169 |
|
170 |
# # Create an empty graph
|
171 |
# G = nx.Graph()
|