-
Notifications
You must be signed in to change notification settings - Fork 126
/
Copy pathApp.py
791 lines (645 loc) · 43 KB
/
App.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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
# Developed by dnoobnerd [https://dnoobnerd.netlify.app] Made with Streamlit
###### Packages Used ######
import streamlit as st # core package used in this project
import pandas as pd
import base64, random
import time,datetime
import pymysql
import os
import socket
import platform
import geocoder
import secrets
import io,random
import plotly.express as px # to create visualisations at the admin session
import plotly.graph_objects as go
from geopy.geocoders import Nominatim
# libraries used to parse the pdf files
from pyresparser import ResumeParser
from pdfminer3.layout import LAParams, LTTextBox
from pdfminer3.pdfpage import PDFPage
from pdfminer3.pdfinterp import PDFResourceManager
from pdfminer3.pdfinterp import PDFPageInterpreter
from pdfminer3.converter import TextConverter
from streamlit_tags import st_tags
from PIL import Image
# pre stored data for prediction purposes
from Courses import ds_course,web_course,android_course,ios_course,uiux_course,resume_videos,interview_videos
import nltk
nltk.download('stopwords')
###### Preprocessing functions ######
# Generates a link allowing the data in a given panda dataframe to be downloaded in csv format
def get_csv_download_link(df,filename,text):
csv = df.to_csv(index=False)
## bytes conversions
b64 = base64.b64encode(csv.encode()).decode()
href = f'<a href="data:file/csv;base64,{b64}" download="{filename}">{text}</a>'
return href
# Reads Pdf file and check_extractable
def pdf_reader(file):
resource_manager = PDFResourceManager()
fake_file_handle = io.StringIO()
converter = TextConverter(resource_manager, fake_file_handle, laparams=LAParams())
page_interpreter = PDFPageInterpreter(resource_manager, converter)
with open(file, 'rb') as fh:
for page in PDFPage.get_pages(fh,
caching=True,
check_extractable=True):
page_interpreter.process_page(page)
print(page)
text = fake_file_handle.getvalue()
## close open handles
converter.close()
fake_file_handle.close()
return text
# show uploaded file path to view pdf_display
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="1000" type="application/pdf"></iframe>'
st.markdown(pdf_display, unsafe_allow_html=True)
# course recommendations which has data already loaded from Courses.py
def course_recommender(course_list):
st.subheader("**Courses & Certificates Recommendations 👨🎓**")
c = 0
rec_course = []
## slider to choose from range 1-10
no_of_reco = st.slider('Choose Number of Course Recommendations:', 1, 10, 5)
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
###### Database Stuffs ######
# sql connector
connection = pymysql.connect(host='localhost',user='root',password='root@MySQL4admin',db='cv')
cursor = connection.cursor()
# inserting miscellaneous data, fetched results, prediction and recommendation into user_data table
def insert_data(sec_token,ip_add,host_name,dev_user,os_name_ver,latlong,city,state,country,act_name,act_mail,act_mob,name,email,res_score,timestamp,no_of_pages,reco_field,cand_level,skills,recommended_skills,courses,pdf_name):
DB_table_name = 'user_data'
insert_sql = "insert into " + DB_table_name + """
values (0,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"""
rec_values = (str(sec_token),str(ip_add),host_name,dev_user,os_name_ver,str(latlong),city,state,country,act_name,act_mail,act_mob,name,email,str(res_score),timestamp,str(no_of_pages),reco_field,cand_level,skills,recommended_skills,courses,pdf_name)
cursor.execute(insert_sql, rec_values)
connection.commit()
# inserting feedback data into user_feedback table
def insertf_data(feed_name,feed_email,feed_score,comments,Timestamp):
DBf_table_name = 'user_feedback'
insertfeed_sql = "insert into " + DBf_table_name + """
values (0,%s,%s,%s,%s,%s)"""
rec_values = (feed_name, feed_email, feed_score, comments, Timestamp)
cursor.execute(insertfeed_sql, rec_values)
connection.commit()
###### Setting Page Configuration (favicon, Logo, Title) ######
st.set_page_config(
page_title="AI Resume Analyzer",
page_icon='./Logo/recommend.png',
)
###### Main function run() ######
def run():
# (Logo, Heading, Sidebar etc)
img = Image.open('./Logo/RESUM.png')
st.image(img)
st.sidebar.markdown("# Choose Something...")
activities = ["User", "Feedback", "About", "Admin"]
choice = st.sidebar.selectbox("Choose among the given options:", activities)
link = '<b>Built with 🤍 by <a href="https://dnoobnerd.netlify.app/" style="text-decoration: none; color: #021659;">Deepak Padhi</a></b>'
st.sidebar.markdown(link, unsafe_allow_html=True)
st.sidebar.markdown('''
<!-- site visitors -->
<div id="sfct2xghr8ak6lfqt3kgru233378jya38dy" hidden></div>
<noscript>
<a href="https://www.freecounterstat.com" title="hit counter">
<img src="https://counter9.stat.ovh/private/freecounterstat.php?c=t2xghr8ak6lfqt3kgru233378jya38dy" border="0" title="hit counter" alt="hit counter"> -->
</a>
</noscript>
<p>Visitors <img src="https://counter9.stat.ovh/private/freecounterstat.php?c=t2xghr8ak6lfqt3kgru233378jya38dy" title="Free Counter" Alt="web counter" width="60px" border="0" /></p>
''', unsafe_allow_html=True)
###### Creating Database and Table ######
# Create the DB
db_sql = """CREATE DATABASE IF NOT EXISTS CV;"""
cursor.execute(db_sql)
# Create table user_data and user_feedback
DB_table_name = 'user_data'
table_sql = "CREATE TABLE IF NOT EXISTS " + DB_table_name + """
(ID INT NOT NULL AUTO_INCREMENT,
sec_token varchar(20) NOT NULL,
ip_add varchar(50) NULL,
host_name varchar(50) NULL,
dev_user varchar(50) NULL,
os_name_ver varchar(50) NULL,
latlong varchar(50) NULL,
city varchar(50) NULL,
state varchar(50) NULL,
country varchar(50) NULL,
act_name varchar(50) NOT NULL,
act_mail varchar(50) NOT NULL,
act_mob varchar(20) NOT NULL,
Name varchar(500) NOT NULL,
Email_ID VARCHAR(500) NOT NULL,
resume_score VARCHAR(8) NOT NULL,
Timestamp VARCHAR(50) NOT NULL,
Page_no VARCHAR(5) NOT NULL,
Predicted_Field BLOB NOT NULL,
User_level BLOB NOT NULL,
Actual_skills BLOB NOT NULL,
Recommended_skills BLOB NOT NULL,
Recommended_courses BLOB NOT NULL,
pdf_name varchar(50) NOT NULL,
PRIMARY KEY (ID)
);
"""
cursor.execute(table_sql)
DBf_table_name = 'user_feedback'
tablef_sql = "CREATE TABLE IF NOT EXISTS " + DBf_table_name + """
(ID INT NOT NULL AUTO_INCREMENT,
feed_name varchar(50) NOT NULL,
feed_email VARCHAR(50) NOT NULL,
feed_score VARCHAR(5) NOT NULL,
comments VARCHAR(100) NULL,
Timestamp VARCHAR(50) NOT NULL,
PRIMARY KEY (ID)
);
"""
cursor.execute(tablef_sql)
###### CODE FOR CLIENT SIDE (USER) ######
if choice == 'User':
# Collecting Miscellaneous Information
act_name = st.text_input('Name*')
act_mail = st.text_input('Mail*')
act_mob = st.text_input('Mobile Number*')
sec_token = secrets.token_urlsafe(12)
host_name = socket.gethostname()
ip_add = socket.gethostbyname(host_name)
dev_user = os.getlogin()
os_name_ver = platform.system() + " " + platform.release()
g = geocoder.ip('me')
latlong = g.latlng
geolocator = Nominatim(user_agent="geoapiExercises")
location = geolocator.reverse(latlong, language='en')
address = location.raw['address']
cityy = address.get('city', '')
statee = address.get('state', '')
countryy = address.get('country', '')
city = cityy
state = statee
country = countryy
# Upload Resume
st.markdown('''<h5 style='text-align: left; color: #021659;'> Upload Your Resume, And Get Smart Recommendations</h5>''',unsafe_allow_html=True)
## file upload in pdf format
pdf_file = st.file_uploader("Choose your Resume", type=["pdf"])
if pdf_file is not None:
with st.spinner('Hang On While We Cook Magic For You...'):
time.sleep(4)
### saving the uploaded resume to folder
save_image_path = './Uploaded_Resumes/'+pdf_file.name
pdf_name = pdf_file.name
with open(save_image_path, "wb") as f:
f.write(pdf_file.getbuffer())
show_pdf(save_image_path)
### parsing and extracting whole resume
resume_data = ResumeParser(save_image_path).get_extracted_data()
if resume_data:
## Get the whole resume data into resume_text
resume_text = pdf_reader(save_image_path)
## Showing Analyzed data from (resume_data)
st.header("**Resume Analysis 🤘**")
st.success("Hello "+ resume_data['name'])
st.subheader("**Your Basic info 👀**")
try:
st.text('Name: '+resume_data['name'])
st.text('Email: ' + resume_data['email'])
st.text('Contact: ' + resume_data['mobile_number'])
st.text('Degree: '+str(resume_data['degree']))
st.text('Resume pages: '+str(resume_data['no_of_pages']))
except:
pass
## Predicting Candidate Experience Level
### Trying with different possibilities
cand_level = ''
if resume_data['no_of_pages'] < 1:
cand_level = "NA"
st.markdown( '''<h4 style='text-align: left; color: #d73b5c;'>You are at Fresher level!</h4>''',unsafe_allow_html=True)
#### if internship then intermediate level
elif 'INTERNSHIP' in resume_text:
cand_level = "Intermediate"
st.markdown('''<h4 style='text-align: left; color: #1ed760;'>You are at intermediate level!</h4>''',unsafe_allow_html=True)
elif 'INTERNSHIPS' in resume_text:
cand_level = "Intermediate"
st.markdown('''<h4 style='text-align: left; color: #1ed760;'>You are at intermediate level!</h4>''',unsafe_allow_html=True)
elif 'Internship' in resume_text:
cand_level = "Intermediate"
st.markdown('''<h4 style='text-align: left; color: #1ed760;'>You are at intermediate level!</h4>''',unsafe_allow_html=True)
elif 'Internships' in resume_text:
cand_level = "Intermediate"
st.markdown('''<h4 style='text-align: left; color: #1ed760;'>You are at intermediate level!</h4>''',unsafe_allow_html=True)
#### if Work Experience/Experience then Experience level
elif 'EXPERIENCE' in resume_text:
cand_level = "Experienced"
st.markdown('''<h4 style='text-align: left; color: #fba171;'>You are at experience level!''',unsafe_allow_html=True)
elif 'WORK EXPERIENCE' in resume_text:
cand_level = "Experienced"
st.markdown('''<h4 style='text-align: left; color: #fba171;'>You are at experience level!''',unsafe_allow_html=True)
elif 'Experience' in resume_text:
cand_level = "Experienced"
st.markdown('''<h4 style='text-align: left; color: #fba171;'>You are at experience level!''',unsafe_allow_html=True)
elif 'Work Experience' in resume_text:
cand_level = "Experienced"
st.markdown('''<h4 style='text-align: left; color: #fba171;'>You are at experience level!''',unsafe_allow_html=True)
else:
cand_level = "Fresher"
st.markdown('''<h4 style='text-align: left; color: #fba171;'>You are at Fresher level!!''',unsafe_allow_html=True)
## Skills Analyzing and Recommendation
st.subheader("**Skills Recommendation 💡**")
### Current Analyzed Skills
keywords = st_tags(label='### Your Current Skills',
text='See our skills recommendation below',value=resume_data['skills'],key = '1 ')
### Keywords for Recommendations
ds_keyword = ['tensorflow','keras','pytorch','machine learning','deep Learning','flask','streamlit']
web_keyword = ['react', 'django', 'node jS', 'react js', 'php', 'laravel', 'magento', 'wordpress','javascript', 'angular js', 'C#', 'Asp.net', 'flask']
android_keyword = ['android','android development','flutter','kotlin','xml','kivy']
ios_keyword = ['ios','ios development','swift','cocoa','cocoa touch','xcode']
uiux_keyword = ['ux','adobe xd','figma','zeplin','balsamiq','ui','prototyping','wireframes','storyframes','adobe photoshop','photoshop','editing','adobe illustrator','illustrator','adobe after effects','after effects','adobe premier pro','premier pro','adobe indesign','indesign','wireframe','solid','grasp','user research','user experience']
n_any = ['english','communication','writing', 'microsoft office', 'leadership','customer management', 'social media']
### Skill Recommendations Starts
recommended_skills = []
reco_field = ''
rec_course = ''
### condition starts to check skills from keywords and predict field
for i in resume_data['skills']:
#### Data science recommendation
if i.lower() in ds_keyword:
print(i.lower())
reco_field = 'Data Science'
st.success("** Our analysis says you are looking for Data Science Jobs.**")
recommended_skills = ['Data Visualization','Predictive Analysis','Statistical Modeling','Data Mining','Clustering & Classification','Data Analytics','Quantitative Analysis','Web Scraping','ML Algorithms','Keras','Pytorch','Probability','Scikit-learn','Tensorflow',"Flask",'Streamlit']
recommended_keywords = st_tags(label='### Recommended skills for you.',
text='Recommended skills generated from System',value=recommended_skills,key = '2')
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>Adding this skills to resume will boost🚀 the chances of getting a Job</h5>''',unsafe_allow_html=True)
# course recommendation
rec_course = course_recommender(ds_course)
break
#### Web development recommendation
elif i.lower() in web_keyword:
print(i.lower())
reco_field = 'Web Development'
st.success("** Our analysis says you are looking for Web Development Jobs **")
recommended_skills = ['React','Django','Node JS','React JS','php','laravel','Magento','wordpress','Javascript','Angular JS','c#','Flask','SDK']
recommended_keywords = st_tags(label='### Recommended skills for you.',
text='Recommended skills generated from System',value=recommended_skills,key = '3')
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>Adding this skills to resume will boost🚀 the chances of getting a Job💼</h5>''',unsafe_allow_html=True)
# course recommendation
rec_course = course_recommender(web_course)
break
#### Android App Development
elif i.lower() in android_keyword:
print(i.lower())
reco_field = 'Android Development'
st.success("** Our analysis says you are looking for Android App Development Jobs **")
recommended_skills = ['Android','Android development','Flutter','Kotlin','XML','Java','Kivy','GIT','SDK','SQLite']
recommended_keywords = st_tags(label='### Recommended skills for you.',
text='Recommended skills generated from System',value=recommended_skills,key = '4')
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>Adding this skills to resume will boost🚀 the chances of getting a Job💼</h5>''',unsafe_allow_html=True)
# course recommendation
rec_course = course_recommender(android_course)
break
#### IOS App Development
elif i.lower() in ios_keyword:
print(i.lower())
reco_field = 'IOS Development'
st.success("** Our analysis says you are looking for IOS App Development Jobs **")
recommended_skills = ['IOS','IOS Development','Swift','Cocoa','Cocoa Touch','Xcode','Objective-C','SQLite','Plist','StoreKit',"UI-Kit",'AV Foundation','Auto-Layout']
recommended_keywords = st_tags(label='### Recommended skills for you.',
text='Recommended skills generated from System',value=recommended_skills,key = '5')
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>Adding this skills to resume will boost🚀 the chances of getting a Job💼</h5>''',unsafe_allow_html=True)
# course recommendation
rec_course = course_recommender(ios_course)
break
#### Ui-UX Recommendation
elif i.lower() in uiux_keyword:
print(i.lower())
reco_field = 'UI-UX Development'
st.success("** Our analysis says you are looking for UI-UX Development Jobs **")
recommended_skills = ['UI','User Experience','Adobe XD','Figma','Zeplin','Balsamiq','Prototyping','Wireframes','Storyframes','Adobe Photoshop','Editing','Illustrator','After Effects','Premier Pro','Indesign','Wireframe','Solid','Grasp','User Research']
recommended_keywords = st_tags(label='### Recommended skills for you.',
text='Recommended skills generated from System',value=recommended_skills,key = '6')
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>Adding this skills to resume will boost🚀 the chances of getting a Job💼</h5>''',unsafe_allow_html=True)
# course recommendation
rec_course = course_recommender(uiux_course)
break
#### For Not Any Recommendations
elif i.lower() in n_any:
print(i.lower())
reco_field = 'NA'
st.warning("** Currently our tool only predicts and recommends for Data Science, Web, Android, IOS and UI/UX Development**")
recommended_skills = ['No Recommendations']
recommended_keywords = st_tags(label='### Recommended skills for you.',
text='Currently No Recommendations',value=recommended_skills,key = '6')
st.markdown('''<h5 style='text-align: left; color: #092851;'>Maybe Available in Future Updates</h5>''',unsafe_allow_html=True)
# course recommendation
rec_course = "Sorry! Not Available for this Field"
break
## Resume Scorer & Resume Writing Tips
st.subheader("**Resume Tips & Ideas 🥂**")
resume_score = 0
### Predicting Whether these key points are added to the resume
if 'Objective' or 'Summary' in resume_text:
resume_score = resume_score+6
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Objective/Summary</h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add your career objective, it will give your career intension to the Recruiters.</h4>''',unsafe_allow_html=True)
if 'Education' or 'School' or 'College' in resume_text:
resume_score = resume_score + 12
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Education Details</h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add Education. It will give Your Qualification level to the recruiter</h4>''',unsafe_allow_html=True)
if 'EXPERIENCE' in resume_text:
resume_score = resume_score + 16
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Experience</h4>''',unsafe_allow_html=True)
elif 'Experience' in resume_text:
resume_score = resume_score + 16
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Experience</h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add Experience. It will help you to stand out from crowd</h4>''',unsafe_allow_html=True)
if 'INTERNSHIPS' in resume_text:
resume_score = resume_score + 6
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Internships</h4>''',unsafe_allow_html=True)
elif 'INTERNSHIP' in resume_text:
resume_score = resume_score + 6
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Internships</h4>''',unsafe_allow_html=True)
elif 'Internships' in resume_text:
resume_score = resume_score + 6
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Internships</h4>''',unsafe_allow_html=True)
elif 'Internship' in resume_text:
resume_score = resume_score + 6
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Internships</h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add Internships. It will help you to stand out from crowd</h4>''',unsafe_allow_html=True)
if 'SKILLS' in resume_text:
resume_score = resume_score + 7
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Skills</h4>''',unsafe_allow_html=True)
elif 'SKILL' in resume_text:
resume_score = resume_score + 7
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Skills</h4>''',unsafe_allow_html=True)
elif 'Skills' in resume_text:
resume_score = resume_score + 7
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Skills</h4>''',unsafe_allow_html=True)
elif 'Skill' in resume_text:
resume_score = resume_score + 7
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added Skills</h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add Skills. It will help you a lot</h4>''',unsafe_allow_html=True)
if 'HOBBIES' in resume_text:
resume_score = resume_score + 4
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Hobbies</h4>''',unsafe_allow_html=True)
elif 'Hobbies' in resume_text:
resume_score = resume_score + 4
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Hobbies</h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add Hobbies. It will show your personality to the Recruiters and give the assurance that you are fit for this role or not.</h4>''',unsafe_allow_html=True)
if 'INTERESTS'in resume_text:
resume_score = resume_score + 5
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Interest</h4>''',unsafe_allow_html=True)
elif 'Interests'in resume_text:
resume_score = resume_score + 5
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Interest</h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add Interest. It will show your interest other that job.</h4>''',unsafe_allow_html=True)
if 'ACHIEVEMENTS' in resume_text:
resume_score = resume_score + 13
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Achievements </h4>''',unsafe_allow_html=True)
elif 'Achievements' in resume_text:
resume_score = resume_score + 13
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Achievements </h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add Achievements. It will show that you are capable for the required position.</h4>''',unsafe_allow_html=True)
if 'CERTIFICATIONS' in resume_text:
resume_score = resume_score + 12
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Certifications </h4>''',unsafe_allow_html=True)
elif 'Certifications' in resume_text:
resume_score = resume_score + 12
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Certifications </h4>''',unsafe_allow_html=True)
elif 'Certification' in resume_text:
resume_score = resume_score + 12
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Certifications </h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] Please add Certifications. It will show that you have done some specialization for the required position.</h4>''',unsafe_allow_html=True)
if 'PROJECTS' in resume_text:
resume_score = resume_score + 19
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Projects</h4>''',unsafe_allow_html=True)
elif 'PROJECT' in resume_text:
resume_score = resume_score + 19
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Projects</h4>''',unsafe_allow_html=True)
elif 'Projects' in resume_text:
resume_score = resume_score + 19
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Projects</h4>''',unsafe_allow_html=True)
elif 'Project' in resume_text:
resume_score = resume_score + 19
st.markdown('''<h5 style='text-align: left; color: #1ed760;'>[+] Awesome! You have added your Projects</h4>''',unsafe_allow_html=True)
else:
st.markdown('''<h5 style='text-align: left; color: #000000;'>[-] 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 📝**")
st.markdown(
"""
<style>
.stProgress > div > div > div > div {
background-color: #d73b5c;
}
</style>""",
unsafe_allow_html=True,
)
### Score Bar
my_bar = st.progress(0)
score = 0
for percent_complete in range(resume_score):
score +=1
time.sleep(0.1)
my_bar.progress(percent_complete + 1)
### Score
st.success('** Your Resume Writing Score: ' + str(score)+'**')
st.warning("** Note: This score is calculated based on the content that you have in your Resume. **")
# print(str(sec_token), str(ip_add), (host_name), (dev_user), (os_name_ver), (latlong), (city), (state), (country), (act_name), (act_mail), (act_mob), resume_data['name'], resume_data['email'], str(resume_score), timestamp, str(resume_data['no_of_pages']), reco_field, cand_level, str(resume_data['skills']), str(recommended_skills), str(rec_course), pdf_name)
### Getting Current Date and Time
ts = time.time()
cur_date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d')
cur_time = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S')
timestamp = str(cur_date+'_'+cur_time)
## Calling insert_data to add all the data into user_data
insert_data(str(sec_token), str(ip_add), (host_name), (dev_user), (os_name_ver), (latlong), (city), (state), (country), (act_name), (act_mail), (act_mob), resume_data['name'], resume_data['email'], str(resume_score), timestamp, str(resume_data['no_of_pages']), reco_field, cand_level, str(resume_data['skills']), str(recommended_skills), str(rec_course), pdf_name)
## Recommending Resume Writing Video
st.header("**Bonus Video for Resume Writing Tips💡**")
resume_vid = random.choice(resume_videos)
st.video(resume_vid)
## Recommending Interview Preparation Video
st.header("**Bonus Video for Interview Tips💡**")
interview_vid = random.choice(interview_videos)
st.video(interview_vid)
## On Successful Result
st.balloons()
else:
st.error('Something went wrong..')
###### CODE FOR FEEDBACK SIDE ######
elif choice == 'Feedback':
# timestamp
ts = time.time()
cur_date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d')
cur_time = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S')
timestamp = str(cur_date+'_'+cur_time)
# Feedback Form
with st.form("my_form"):
st.write("Feedback form")
feed_name = st.text_input('Name')
feed_email = st.text_input('Email')
feed_score = st.slider('Rate Us From 1 - 5', 1, 5)
comments = st.text_input('Comments')
Timestamp = timestamp
submitted = st.form_submit_button("Submit")
if submitted:
## Calling insertf_data to add dat into user feedback
insertf_data(feed_name,feed_email,feed_score,comments,Timestamp)
## Success Message
st.success("Thanks! Your Feedback was recorded.")
## On Successful Submit
st.balloons()
# query to fetch data from user feedback table
query = 'select * from user_feedback'
plotfeed_data = pd.read_sql(query, connection)
# fetching feed_score from the query and getting the unique values and total value count
labels = plotfeed_data.feed_score.unique()
values = plotfeed_data.feed_score.value_counts()
# plotting pie chart for user ratings
st.subheader("**Past User Rating's**")
fig = px.pie(values=values, names=labels, title="Chart of User Rating Score From 1 - 5", color_discrete_sequence=px.colors.sequential.Aggrnyl)
st.plotly_chart(fig)
# Fetching Comment History
cursor.execute('select feed_name, comments from user_feedback')
plfeed_cmt_data = cursor.fetchall()
st.subheader("**User Comment's**")
dff = pd.DataFrame(plfeed_cmt_data, columns=['User', 'Comment'])
st.dataframe(dff, width=1000)
###### CODE FOR ABOUT PAGE ######
elif choice == 'About':
st.subheader("**About The Tool - AI RESUME ANALYZER**")
st.markdown('''
<p align='justify'>
A tool which parses information from a resume using natural language processing and finds the keywords, cluster them onto sectors based on their keywords. And lastly show recommendations, predictions, analytics to the applicant based on keyword matching.
</p>
<p align="justify">
<b>How to use it: -</b> <br/><br/>
<b>User -</b> <br/>
In the Side Bar choose yourself as user and fill the required fields and upload your resume in pdf format.<br/>
Just sit back and relax our tool will do the magic on it's own.<br/><br/>
<b>Feedback -</b> <br/>
A place where user can suggest some feedback about the tool.<br/><br/>
<b>Admin -</b> <br/>
For login use <b>admin</b> as username and <b>admin@resume-analyzer</b> as password.<br/>
It will load all the required stuffs and perform analysis.
</p><br/><br/>
<p align="justify">
Built with 🤍 by
<a href="https://dnoobnerd.netlify.app/" style="text-decoration: none; color: grey;">Deepak Padhi</a> through
<a href="https://www.linkedin.com/in/mrbriit/" style="text-decoration: none; color: grey;">Dr Bright --(Data Scientist)</a>
</p>
''',unsafe_allow_html=True)
###### CODE FOR ADMIN SIDE (ADMIN) ######
else:
st.success('Welcome to Admin Side')
# Admin Login
ad_user = st.text_input("Username")
ad_password = st.text_input("Password", type='password')
if st.button('Login'):
## Credentials
if ad_user == 'admin' and ad_password == 'admin@resume-analyzer':
### Fetch miscellaneous data from user_data(table) and convert it into dataframe
cursor.execute('''SELECT ID, ip_add, resume_score, convert(Predicted_Field using utf8), convert(User_level using utf8), city, state, country from user_data''')
datanalys = cursor.fetchall()
plot_data = pd.DataFrame(datanalys, columns=['Idt', 'IP_add', 'resume_score', 'Predicted_Field', 'User_Level', 'City', 'State', 'Country'])
### Total Users Count with a Welcome Message
values = plot_data.Idt.count()
st.success("Welcome Deepak ! Total %d " % values + " User's Have Used Our Tool : )")
### Fetch user data from user_data(table) and convert it into dataframe
cursor.execute('''SELECT ID, sec_token, ip_add, act_name, act_mail, act_mob, convert(Predicted_Field using utf8), Timestamp, Name, Email_ID, resume_score, Page_no, pdf_name, convert(User_level using utf8), convert(Actual_skills using utf8), convert(Recommended_skills using utf8), convert(Recommended_courses using utf8), city, state, country, latlong, os_name_ver, host_name, dev_user from user_data''')
data = cursor.fetchall()
st.header("**User's Data**")
df = pd.DataFrame(data, columns=['ID', 'Token', 'IP Address', 'Name', 'Mail', 'Mobile Number', 'Predicted Field', 'Timestamp',
'Predicted Name', 'Predicted Mail', 'Resume Score', 'Total Page', 'File Name',
'User Level', 'Actual Skills', 'Recommended Skills', 'Recommended Course',
'City', 'State', 'Country', 'Lat Long', 'Server OS', 'Server Name', 'Server User',])
### Viewing the dataframe
st.dataframe(df)
### Downloading Report of user_data in csv file
st.markdown(get_csv_download_link(df,'User_Data.csv','Download Report'), unsafe_allow_html=True)
### Fetch feedback data from user_feedback(table) and convert it into dataframe
cursor.execute('''SELECT * from user_feedback''')
data = cursor.fetchall()
st.header("**User's Feedback Data**")
df = pd.DataFrame(data, columns=['ID', 'Name', 'Email', 'Feedback Score', 'Comments', 'Timestamp'])
st.dataframe(df)
### query to fetch data from user_feedback(table)
query = 'select * from user_feedback'
plotfeed_data = pd.read_sql(query, connection)
### Analyzing All the Data's in pie charts
# fetching feed_score from the query and getting the unique values and total value count
labels = plotfeed_data.feed_score.unique()
values = plotfeed_data.feed_score.value_counts()
# Pie chart for user ratings
st.subheader("**User Rating's**")
fig = px.pie(values=values, names=labels, title="Chart of User Rating Score From 1 - 5 🤗", color_discrete_sequence=px.colors.sequential.Aggrnyl)
st.plotly_chart(fig)
# fetching Predicted_Field from the query and getting the unique values and total value count
labels = plot_data.Predicted_Field.unique()
values = plot_data.Predicted_Field.value_counts()
# Pie chart for predicted field recommendations
st.subheader("**Pie-Chart for Predicted Field Recommendation**")
fig = px.pie(df, values=values, names=labels, title='Predicted Field according to the Skills 👽', color_discrete_sequence=px.colors.sequential.Aggrnyl_r)
st.plotly_chart(fig)
# fetching User_Level from the query and getting the unique values and total value count
labels = plot_data.User_Level.unique()
values = plot_data.User_Level.value_counts()
# Pie chart for User's👨💻 Experienced Level
st.subheader("**Pie-Chart for User's Experienced Level**")
fig = px.pie(df, values=values, names=labels, title="Pie-Chart 📈 for User's 👨💻 Experienced Level", color_discrete_sequence=px.colors.sequential.RdBu)
st.plotly_chart(fig)
# fetching resume_score from the query and getting the unique values and total value count
labels = plot_data.resume_score.unique()
values = plot_data.resume_score.value_counts()
# Pie chart for Resume Score
st.subheader("**Pie-Chart for Resume Score**")
fig = px.pie(df, values=values, names=labels, title='From 1 to 100 💯', color_discrete_sequence=px.colors.sequential.Agsunset)
st.plotly_chart(fig)
# fetching IP_add from the query and getting the unique values and total value count
labels = plot_data.IP_add.unique()
values = plot_data.IP_add.value_counts()
# Pie chart for Users
st.subheader("**Pie-Chart for Users App Used Count**")
fig = px.pie(df, values=values, names=labels, title='Usage Based On IP Address 👥', color_discrete_sequence=px.colors.sequential.matter_r)
st.plotly_chart(fig)
# fetching City from the query and getting the unique values and total value count
labels = plot_data.City.unique()
values = plot_data.City.value_counts()
# Pie chart for City
st.subheader("**Pie-Chart for City**")
fig = px.pie(df, values=values, names=labels, title='Usage Based On City 🌆', color_discrete_sequence=px.colors.sequential.Jet)
st.plotly_chart(fig)
# fetching State from the query and getting the unique values and total value count
labels = plot_data.State.unique()
values = plot_data.State.value_counts()
# Pie chart for State
st.subheader("**Pie-Chart for State**")
fig = px.pie(df, values=values, names=labels, title='Usage Based on State 🚉', color_discrete_sequence=px.colors.sequential.PuBu_r)
st.plotly_chart(fig)
# fetching Country from the query and getting the unique values and total value count
labels = plot_data.Country.unique()
values = plot_data.Country.value_counts()
# Pie chart for Country
st.subheader("**Pie-Chart for Country**")
fig = px.pie(df, values=values, names=labels, title='Usage Based on Country 🌏', color_discrete_sequence=px.colors.sequential.Purpor_r)
st.plotly_chart(fig)
## For Wrong Credentials
else:
st.error("Wrong ID & Password Provided")
# Calling the main (run()) function to make the whole process run
run()