Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,27 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.")
|