Spaces:
Runtime error
Runtime error
Commit
·
fee5ced
1
Parent(s):
1750d29
Update app.py
Browse files
app.py
CHANGED
@@ -25,14 +25,15 @@ if submit_button:
|
|
25 |
|
26 |
# Perform calculations
|
27 |
|
28 |
-
|
29 |
-
|
30 |
sentences.append(sentence_1)
|
31 |
sentences.append(sentence_2)
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
st.write("")
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
25 |
|
26 |
# Perform calculations
|
27 |
|
28 |
+
# Append input sentences to 'sentences' list
|
|
|
29 |
sentences.append(sentence_1)
|
30 |
sentences.append(sentence_2)
|
31 |
|
32 |
+
# Create embeddings for both sentences
|
33 |
+
sentence_embeddings = model.encode(sentences)
|
34 |
+
|
|
|
35 |
|
36 |
+
st.write('Similarity between {} and {} is {}'.format(sentence_1,
|
37 |
+
sentence_2,
|
38 |
+
cosine_similarity(sentence_embeddings[0].reshape(1, -1),
|
39 |
+
sentence_embeddings[1].reshape(1, -1))[0][0]))
|