Spaces:
Runtime error
Runtime error
Commit
·
8b36a1a
1
Parent(s):
652e4d8
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.")
|