Kuaaangwen commited on
Commit
82206e8
·
1 Parent(s): a1229f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -81,18 +81,22 @@ if sidebar_selectbox == "Bulk upload and mark":
81
 
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
 
 
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