import streamlit as st from sentence_transformers import SentenceTransformer import numpy as np st.title("Sentence Similarity") st.write("This app uses Sentence Transformer to calculate the similarity between two sentences.") sentence1 = st.text_input("Enter the first sentence") sentence2 = st.text_input("Enter the second sentence") if st.button("Calculate Similarity"): model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2') embeddings = model.encode([sentence1, sentence2]) similarity = np.dot(embeddings[0], embeddings[1]) st.write("The similarity between the two sentences is:", similarity)