laurenramroop commited on
Commit
a65a15f
·
verified ·
1 Parent(s): 5cacf0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -12
app.py CHANGED
@@ -1,11 +1,4 @@
1
  import streamlit as st
2
- from sentence_transformers import SentenceTransformer, util
3
-
4
- @st.cache_resource # Cache the model for faster loading
5
- def load_model():
6
- return SentenceTransformer('sentence-transformers/all-mpnet-base-v2')
7
-
8
- model = load_model()
9
 
10
  st.title("Text Similarity Checker")
11
 
@@ -13,8 +6,4 @@ text1 = st.text_input("Enter the first text:")
13
  text2 = st.text_input("Enter the second text:")
14
 
15
  if text1 and text2:
16
- # Calculate embeddings and similarity
17
- embedding1 = model.encode(text1)
18
- embedding2 = model.encode(text2)
19
- similarity = util.cos_sim(embedding1, embedding2).item() * 100
20
- st.write(f"**Similarity Score:** {similarity:.2f}%")
 
1
  import streamlit as st
 
 
 
 
 
 
 
2
 
3
  st.title("Text Similarity Checker")
4
 
 
6
  text2 = st.text_input("Enter the second text:")
7
 
8
  if text1 and text2:
9
+ st.write("You entered text in both fields.")