File size: 899 Bytes
514343b
 
843aeb0
 
9983408
 
843aeb0
44264ed
 
88993fe
9983408
418bd7c
 
88993fe
44264ed
418bd7c
 
88993fe
 
 
 
 
 
3a19224
418bd7c
 
 
 
 
88993fe
 
c996dc1
b1d589a
1750d29
 
 
b1d589a
1750d29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

import streamlit as st
from transformers import pipeline
from textblob import TextBlob
from sentence_transformers import SentenceTransformer
from sklearn.metrics.pairwise import cosine_similarity

model = SentenceTransformer('paraphrase-xlm-r-multilingual-v1')

sentences = []
     
# Streamlit interface
      
st.title("Sentence Similarity")

# Streamlit webpage elements

sentence_1 = st.text_input("Sentence 1 input")

sentence_2 = st.text_input("Sentence 2 input")

submit_button = st.button("submit")

if submit_button:

       # Perform calculations
       
       sentence_embeddings = model.encode(sentences)

       sentences.append(sentence_1)
       sentences.append(sentence_2)
       
       for sentence, embedding in zip(sentences, sentence_embeddings):
           st.write("Sentence:", sentence)
           st.write("Embedding:", embedding)
           st.write("")