peter2000 commited on
Commit
35c4462
1 Parent(s): f68327f

Update apps/similarity.py

Browse files
Files changed (1) hide show
  1. apps/similarity.py +7 -7
apps/similarity.py CHANGED
@@ -18,10 +18,10 @@ def app():
18
  if st.button("Embed"):
19
  with st.spinner("Embedding comparing your inputs"):
20
 
21
- document = [word_to_embed1 ,word_to_embed2]
22
- #Encode paragraphs
23
- document_embeddings = model.encode(document, show_progress_bar=False)
24
- #Compute cosine similarity between labels sentences and paragraphs
25
- similarity_matrix = cosine_similarity(label_embeddings, document_embeddings)
26
-
27
- st.write("Text similarity:" similarity_matrix)
 
18
  if st.button("Embed"):
19
  with st.spinner("Embedding comparing your inputs"):
20
 
21
+ document = [word_to_embed1 ,word_to_embed2]
22
+ #Encode paragraphs
23
+ document_embeddings = model.encode(document, show_progress_bar=False)
24
+ #Compute cosine similarity between labels sentences and paragraphs
25
+ similarity_matrix = cosine_similarity(label_embeddings, document_embeddings)
26
+
27
+ st.write("Text similarity:" similarity_matrix)