shivanis14
commited on
Commit
•
678e3c2
1
Parent(s):
647a8bc
Update calc_cosine_similarity.py
Browse files
calc_cosine_similarity.py
CHANGED
@@ -20,8 +20,14 @@ def find_cosine_similarity(text1, text2):
|
|
20 |
def find_embedding(texts):
|
21 |
global model
|
22 |
embeddings = []
|
23 |
-
|
|
|
|
|
24 |
for text in texts:
|
|
|
|
|
|
|
|
|
25 |
print(f"Finding embedding for {text}")
|
26 |
embeddings.append(model.encode(text, convert_to_tensor=True))
|
27 |
|
|
|
20 |
def find_embedding(texts):
|
21 |
global model
|
22 |
embeddings = []
|
23 |
+
|
24 |
+
c = 0
|
25 |
+
lim = 10
|
26 |
for text in texts:
|
27 |
+
if c > lim:
|
28 |
+
continue
|
29 |
+
else:
|
30 |
+
c += 1
|
31 |
print(f"Finding embedding for {text}")
|
32 |
embeddings.append(model.encode(text, convert_to_tensor=True))
|
33 |
|