File size: 2,242 Bytes
cd8c8cf 647f3d8 8bc65a3 a471b38 289e528 8bc65a3 f34e136 57fdcf3 289e528 647f3d8 d35d353 b2ebc6d a471b38 f6a5cef 8bc65a3 666e40b 3736724 a471b38 cfb6690 26fe61e d35d353 3f63f11 8bc65a3 a471b38 c4be246 8bc65a3 c4be246 8bc65a3 c4be246 8bc65a3 c4be246 8bc65a3 c4be246 8bc65a3 c4be246 8bc65a3 c4be246 8bc65a3 c4be246 f34e136 1e2f475 a471b38 8bc65a3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
import streamlit as st
from sentence_transformers import SentenceTransformer
from sklearn.metrics.pairwise import cosine_similarity
from keyphrasetransformer import KeyPhraseTransformer
from wordcloud import WordCloud
import matplotlib.pyplot as plt
import evaluate
kp = KeyPhraseTransformer()
@st.cache_resource
def load_model():
model = SentenceTransformer('all-MiniLM-L6-v2')
return model
def calculate_similarity(model, text1, text2):
embedding1 = model.encode([text1])
embedding2 = model.encode([text2])
return cosine_similarity(embedding1, embedding2)[0][0]
def generate_wordcloud(text, title):
wordcloud = WordCloud(width=800, height=400, background_color='white').generate(text)
plt.figure(figsize=(10, 5))
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis('off')
plt.title(title)
st.pyplot(plt)
st.title("Resume Match Calculator")
model = load_model()
# Set the font size for the "Paste the Job Description" text
st.markdown("<style>#fc1{font-size: 20px !important;}</style>", unsafe_allow_html=True)
jd = st.text_area("Paste the Job Description:", height=100)
resume = st.text_area("Paste Your the Resume:", height=100)
if st.button("Calculate Match Score"):
if jd and resume:
score = calculate_similarity(model, jd, resume)
jp=kp.get_key_phrases(jd)
rp=kp.get_key_phrases(resume)
# Find missing keywords in rp with respect to jp
missing_keywords = set(jp) - set(rp)
# Generate word clouds for JD and Resume
generate_wordcloud(' '.join(jp), 'Word Cloud for JD Keywords')
generate_wordcloud(' '.join(rp), 'Word Cloud for Resume Keywords')
# st.write(f"The match score is: {score}", )
st.write("The match score is:")
st.write(score)
st.write("JD Keywords:" )
st.write(jp)
st.write("Resume Keywords:" )
st.write(rp)
st.write("Missing Keywords in Resume:" )
st.write(list(missing_keywords))
metric = evaluate.load("accuracy")
st.write("The Accuracy score is:")
st.write(metric)
else:
st.write("Please enter both the job description and resume.", )
|