Spaces:
Runtime error
Runtime error
Commit
·
a1229f1
1
Parent(s):
b0f213e
Update app.py
Browse files
app.py
CHANGED
@@ -82,12 +82,20 @@ if sidebar_selectbox == "Bulk upload and mark":
|
|
82 |
similarity_scores = []
|
83 |
|
84 |
for index, sentence in enumerate(range(total_rows)):
|
85 |
-
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
# Append new column to dataframe
|
90 |
|
91 |
-
|
92 |
|
93 |
st.dataframe(df)
|
|
|
82 |
similarity_scores = []
|
83 |
|
84 |
for index, sentence in enumerate(range(total_rows)):
|
|
|
85 |
|
86 |
+
sentence_comparison = df.get_value(index,1)
|
87 |
+
sentences.append(sentence_reference)
|
88 |
+
sentences.append(sentence_comparison)
|
89 |
+
|
90 |
+
sentence_embeddings = model.encode(sentences)
|
91 |
+
|
92 |
+
cos_sim = cosine_similarity(sentence_embeddings[0].reshape(1, -1), sentence_embeddings[1].reshape(1, -1))[0][0]
|
93 |
+
cos_sim = round(cos_sim * 100)
|
94 |
+
|
95 |
+
similarity_scores.append(cos_sim)
|
96 |
|
97 |
# Append new column to dataframe
|
98 |
|
99 |
+
df['Similarity'] = similarity_scores
|
100 |
|
101 |
st.dataframe(df)
|