test / app.py
hacpdsae2023's picture
Adding input text to be embedded
00e69cc
raw
history blame
781 Bytes
import streamlit as st
import pandas as pd
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('paraphrase-MiniLM-L6-v2')
input_sentence = st.text_input('Movie title', 'Life of Brian')
#st.write('The current movie title is', title)
#Sentences we want to encode. Example:
sentence = ['This framework generates embeddings for each input sentence']
#Sentences are encoded by calling model.encode()
embedding = model.encode(sentence)
x = st.slider('Select a value')
#st.write(x, 'squared is', x * x, 'embedding', embedding[0][0])
st.write('The embedding of', input_sentence, 'at position',x,'is',embedding[0][int(x)])
uploaded_file = st.file_uploader("Choose a file")
if uploaded_file is not None:
#read csv
df1=pd.read_csv(uploaded_file)