Spaces:
Runtime error
Runtime error
Commit
·
82206e8
1
Parent(s):
a1229f1
Update app.py
Browse files
app.py
CHANGED
@@ -81,18 +81,22 @@ if sidebar_selectbox == "Bulk upload and mark":
|
|
81 |
|
82 |
similarity_scores = []
|
83 |
|
84 |
-
for index
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
|
97 |
# Append new column to dataframe
|
98 |
|
|
|
81 |
|
82 |
similarity_scores = []
|
83 |
|
84 |
+
for index in range(total_rows):
|
85 |
+
|
86 |
+
# Create an empty sentence list
|
87 |
+
sentences = []
|
88 |
+
|
89 |
+
# Compare the setences two by two
|
90 |
+
sentence_comparison = df.get_value(index,1)
|
91 |
+
sentences.append(sentence_reference)
|
92 |
+
sentences.append(sentence_comparison)
|
93 |
+
|
94 |
+
sentence_embeddings = model.encode(sentences)
|
95 |
+
|
96 |
+
cos_sim = cosine_similarity(sentence_embeddings[0].reshape(1, -1), sentence_embeddings[1].reshape(1, -1))[0][0]
|
97 |
+
cos_sim = round(cos_sim * 100)
|
98 |
+
|
99 |
+
similarity_scores.append(cos_sim)
|
100 |
|
101 |
# Append new column to dataframe
|
102 |
|