HACP commited on
Commit
2430162
·
1 Parent(s): 5b6d5fb

Add embedding

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -1,8 +1,18 @@
1
  import streamlit as st
2
  import pandas as pd
3
 
 
 
 
 
 
 
 
 
 
 
4
  x = st.slider('Select a value')
5
- st.write(x, 'squared is', x * x)
6
 
7
 
8
  uploaded_file = st.file_uploader("Choose a file")
 
1
  import streamlit as st
2
  import pandas as pd
3
 
4
+ from sentence_transformers import SentenceTransformer
5
+ model = SentenceTransformer('paraphrase-MiniLM-L6-v2')
6
+
7
+ #Sentences we want to encode. Example:
8
+ sentence = ['This framework generates embeddings for each input sentence']
9
+
10
+
11
+ #Sentences are encoded by calling model.encode()
12
+ embedding = model.encode(sentence)
13
+
14
  x = st.slider('Select a value')
15
+ st.write(x, 'squared is', x * x, 'embedding', embedding[0])
16
 
17
 
18
  uploaded_file = st.file_uploader("Choose a file")