Kuaaangwen commited on
Commit
44264ed
1 Parent(s): e8cbdd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -5,6 +5,8 @@ from textblob import TextBlob
5
  from sentence_transformers import SentenceTransformer
6
  from sklearn.metrics.pairwise import cosine_similarity
7
 
 
 
8
  sentences = \
9
  [
10
  "I have a bigger house than you",
@@ -19,6 +21,13 @@ for sentence, embedding in zip(sentences, sentence_embeddings):
19
  print("")
20
 
21
  print('Similarity between {} and {} is {}'.format(sentences[0],
 
 
 
 
 
 
 
22
  sentences[1],
23
  cosine_similarity(sentence_embeddings[0].reshape(1, -1),
24
  sentence_embeddings[1].reshape(1, -1))[0][0]))
 
5
  from sentence_transformers import SentenceTransformer
6
  from sklearn.metrics.pairwise import cosine_similarity
7
 
8
+ model = SentenceTransformer('paraphrase-xlm-r-multilingual-v1')
9
+
10
  sentences = \
11
  [
12
  "I have a bigger house than you",
 
21
  print("")
22
 
23
  print('Similarity between {} and {} is {}'.format(sentences[0],
24
+ sentences[1],
25
+ cosine_similarity(sentence_embeddings[0].reshape(1, -1),
26
+ sentence_embeddings[1].reshape(1, -1))[0][0]))
27
+
28
+ st.title("Similarity text")
29
+
30
+ st.write('Similarity between {} and {} is {}'.format(sentences[0],
31
  sentences[1],
32
  cosine_similarity(sentence_embeddings[0].reshape(1, -1),
33
  sentence_embeddings[1].reshape(1, -1))[0][0]))