Spaces:
Sleeping
Sleeping
Update apps/similarity.py
Browse files- 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 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
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)
|