Spaces:
Sleeping
Sleeping
File size: 518 Bytes
9763abf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import streamlit as st
from sentence_transformers import SentenceTransformer
# Load the pre-trained model
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
st.title("Sentence Embeddings")
# Input from the user
sentences = st.text_area("Enter sentences (one per line)")
if sentences:
# Split sentences by new line
sentences_list = [s.strip() for s in sentences.split('\n') if s.strip()]
# Get embeddings
embeddings = model.encode(sentences_list).tolist()
st.json(embeddings)
|