-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
248 lines (223 loc) · 9.67 KB
/
main.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
import streamlit as st
import nltk
nltk.download('stopwords')
import base64
from pyresparser import ResumeParser
import re
import pickle
import pandas as pd
import fitz
from PIL import Image
from streamlit_tags import st_tags
import random
from courses import ds_course, web_course, android_course, ios_course, uiux_course, resume_videos, interview_videos
from skills import skills_dict
import time
roles = ['Advocate',
'Arts',
'Automation Testing',
'Blockchain',
'Business Analyst',
'Civil Engineer',
'Data Science',
'Database',
'DevOps Engineer',
'DotNet Developer',
'ETL Developer',
'Electrical Engineering',
'HR',
'Hadoop',
'Health and fitness',
'Java Developer',
'Mechanical Engineer',
'Network Security Engineer',
'Operations Manager',
'PMO (Project Management office)',
'Python Developer',
'SAP Developer',
'Sales',
'Testing',
'Web Designing']
def cleanResume(resumeText):
resumeText = re.sub('http\S+\s*', ' ', resumeText) # remove URLs
resumeText = re.sub('RT|cc', ' ', resumeText) # remove RT and cc
resumeText = re.sub('#\S+', '', resumeText) # remove hashtags
resumeText = re.sub('@\S+', ' ', resumeText) # remove mentions
resumeText = re.sub('[%s]' % re.escape("""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""), ' ', resumeText) # remove punctuations
resumeText = re.sub(r'[^\x00-\x7f]',r' ', resumeText)
resumeText = re.sub('\s+', ' ', resumeText) # remove extra whitespace
return resumeText
def trans_func(inp):
inp = inp.apply(lambda x: cleanResume(x))
return inp.values
def show_pdf(file_path):
with open(file_path,"rb") as f:
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="700" height="700" type="application/pdf"></iframe>'
st.markdown(pdf_display, unsafe_allow_html=True)
def extract_data(file_path):
data = ResumeParser(file_path).get_extracted_data()
return data
def course_recommender(role):
course_list = df[df['Sub-Category']==skills_dict[role][1]][['Title','URL']].values.tolist()
st.subheader("Courses & Certificates:mortar_board: Recommendations")
c = 0
rec_course = []
no_of_reco = st.select_slider('Choose Number of Course Recommendations:', options=[i+1 for i in range(100)])
random.shuffle(course_list)
for c_name, c_link in course_list:
c += 1
st.markdown(f"({c}) [{c_name}]({c_link})")
rec_course.append(c_name)
if c == no_of_reco:
break
return rec_course
st.set_page_config(
page_title = 'Profile Builder App',
page_icon='Parsers-Banner.png'
)
with open('model_pipe','rb') as f:
model = pickle.load(f)
df = pd.read_csv("Online_Courses.csv")
df = df.drop_duplicates(subset=['Title'])
course_list = df['Title'].values.tolist()
st.title('Resume Analyser')
img = Image.open('Parsers-Banner.png')
left_co, cent_co,last_co = st.columns(3)
with cent_co:
st.image(img)
resume = st.file_uploader("Upload your resume",type=['pdf'])
if resume:
with open('resume.pdf','wb') as f:
f.write(resume.getbuffer())
show_pdf("resume.pdf")
data = extract_data("resume.pdf")
if data:
st.success("Hello " + data['name'])
st.subheader("Your Basic Info")
try:
st.text('Name: ' + data['name'])
st.text('Email: ' + data['email'])
st.text('Contact: ' + data['mobile_number'])
st.text('Resume pages: ' + str(data['no_of_pages']))
except:
pass
cand_level = ''
if data['total_experience']:
if data['total_experience']>5:
cand_level = "Fresher"
elif data['total_experience']>2:
cand_level = "Intermediate"
else:
cand_level = "Fresher"
else:
if data['no_of_pages'] == 1:
cand_level = "Fresher"
elif data['no_of_pages'] == 2:
cand_level = "Intermediate"
elif data['no_of_pages'] >= 3:
cand_level = "Experienced"
st.markdown(f'''<h4 style='text-align: left; color: #d73b5c;'>You are looking {cand_level}.</h4>''',
unsafe_allow_html=True)
## Skill shows
keywords = st_tags(label='### Skills that you have',
text='See our skills recommendation',
value=data['skills'], key='1')
doc = fitz.open('resume.pdf')
text = ""
for page in doc:
text+=page.get_text()
role = roles[model.predict(pd.Series([text]))[0]]
st.success(f"According to the analysis, you are interested in {role} jobs")
st.subheader("Skills Recommendation:brain:")
recommended_keywords = st_tags(label='### Recommended skills for you.',
text='Recommended skills generated from System',
value=skills_dict[role][0], key='2')
st.markdown(
'''<h4 style='text-align: left; color: #1ed760;'>Adding this skills to resume will boost🚀 the chances of getting a Job💼</h4>''',
unsafe_allow_html=True)
### Resume writing recommendation
st.subheader("Resume Tips & Ideas:bulb:")
resume_score = 0
if 'Objective' in text:
resume_score = resume_score + 20
st.markdown(
'''<h4 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Objective</h4>''',
unsafe_allow_html=True)
else:
st.markdown(
'''<h4 style='text-align: left; color: #fabc10;'>[-] According to our recommendation please add your career objective, it will give your career intension to the Recruiters.</h4>''',
unsafe_allow_html=True)
if 'Declaration' in text:
resume_score = resume_score + 20
st.markdown(
'''<h4 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Delcaration✍/h4>''',
unsafe_allow_html=True)
else:
st.markdown(
'''<h4 style='text-align: left; color: #fabc10;'>[-] According to our recommendation please add Declaration✍. It will give the assurance that everything written on your resume is true and fully acknowledged by you</h4>''',
unsafe_allow_html=True)
if 'Hobbies' or 'Interests' in text:
resume_score = resume_score + 20
st.markdown(
'''<h4 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Hobbies⚽</h4>''',
unsafe_allow_html=True)
else:
st.markdown(
'''<h4 style='text-align: left; color: #fabc10;'>[-] According to our recommendation please add Hobbies⚽. It will show your persnality to the Recruiters and give the assurance that you are fit for this role or not.</h4>''',
unsafe_allow_html=True)
if 'Achievements' in text:
resume_score = resume_score + 20
st.markdown(
'''<h4 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Achievements🏅 </h4>''',
unsafe_allow_html=True)
else:
st.markdown(
'''<h4 style='text-align: left; color: #fabc10;'>[-] According to our recommendation please add Achievements🏅. It will show that you are capable for the required position.</h4>''',
unsafe_allow_html=True)
if 'Projects' in text:
resume_score = resume_score + 20
st.markdown(
'''<h4 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Projects👨💻 </h4>''',
unsafe_allow_html=True)
else:
st.markdown(
'''<h4 style='text-align: left; color: #fabc10;'>[-] According to our recommendation please add Projects👨💻. It will show that you have done work related the required position or not.</h4>''',
unsafe_allow_html=True)
st.subheader("Resume Score:memo:")
st.markdown(
"""
<style>
.stProgress > div > div > div > div {
background-color: #d73b5c;
}
</style>""",
unsafe_allow_html=True,
)
my_bar = st.progress(0)
score = 0
for percent_complete in range(resume_score):
score += 1
time.sleep(0.01)
my_bar.progress(percent_complete + 1)
st.success('Your Resume Writing Score: ' + str(score))
st.warning(
"Note: This score is calculated based on the content that you have added in your Resume")
rec_course = course_recommender(role)
st.subheader("Search for other courses:bulb:")
course = st.selectbox(label = 'Popular Online Courses',options = course_list)
details = df[df['Title']==course][['URL','Short Intro','Language','Skills']].values.tolist()
st.subheader("Course Details")
#st.dataframe(details.T)
if str(details[0][1]) != 'nan':
st.success("Course Intro")
st.markdown(
f'''<h4 style='text-align: left; color: #fabc10;'> {details[0][1]} </h4>''',
unsafe_allow_html=True)
if str(details[0][2]) != 'nan':
st.success(f"Mode of Instructions: {details[0][2]}")
if str(details[0][3]) != 'nan':
list_sk = details[0][3].split(",")
list_sk2 = st_tags(label='Skills that you will learn',text='skills from course',
value=list_sk, key='3')
st.markdown(f"Course Link: {details[0][0]}")