Unknown92 commited on
Commit
a471b38
·
1 Parent(s): a5e44cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -2
app.py CHANGED
@@ -1,4 +1,27 @@
1
  import streamlit as st
 
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from sentence_transformers import SentenceTransformer
3
+ from sklearn.metrics.pairwise import cosine_similarity
4
 
5
+ @st.cache(allow_output_mutation=True)
6
+ def load_model():
7
+ model = SentenceTransformer('all-MiniLM-L6-v2')
8
+ return model
9
+
10
+ def calculate_similarity(model, text1, text2):
11
+ embedding1 = model.encode([text1])
12
+ embedding2 = model.encode([text2])
13
+ return cosine_similarity(embedding1, embedding2)[0][0]
14
+
15
+ st.title("Resume Matcher")
16
+
17
+ model = load_model()
18
+
19
+ jd = st.text_area("Enter the Job Description:", height=200)
20
+ resume = st.text_area("Enter the Resume:", height=200)
21
+
22
+ if st.button("Calculate Match Score"):
23
+ if jd and resume:
24
+ score = calculate_similarity(model, jd, resume)
25
+ st.write(f"The match score is: {score}")
26
+ else:
27
+ st.write("Please enter both the job description and resume.")