-
Notifications
You must be signed in to change notification settings - Fork 15
/
webapp.py
61 lines (39 loc) · 1.55 KB
/
webapp.py
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
import streamlit as st
import PyPDF2
import pdfplumber
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
st.title("Candidate Selection Tool")
st.subheader("NLP Based Resume Screening")
st.caption("Aim of this project is to check whether a candidate is qualified for a role based his or her education, experience, and other information captured on their resume. In a nutshell, it's a form of pattern matching between a job's requirements and the qualifications of a candidate based on their resume.")
uploadedJD = st.file_uploader("Upload Job Description", type="pdf")
uploadedResume = st.file_uploader("Upload resume",type="pdf")
click = st.button("Process")
try:
global job_description
with pdfplumber.open(uploadedJD) as pdf:
pages = pdf.pages[0]
job_description = pages.extract_text()
except:
st.write("")
try:
global resume
with pdfplumber.open(uploadedResume) as pdf:
pages = pdf.pages[0]
resume = pages.extract_text()
except:
st.write("")
#logic
def getResult(JD_txt,resume_txt):
content = [JD_txt,resume_txt]
cv = CountVectorizer()
matrix = cv.fit_transform(content)
similarity_matrix = cosine_similarity(matrix)
match = similarity_matrix[0][1] * 100
return match
#button
if click:
match = getResult(job_description,resume)
match = round(match,2)
st.write("Match Percentage: ",match,"%")
st.caption(" ~ made by siddhraj")