panchadip commited on
Commit
e560778
·
verified ·
1 Parent(s): d9df6f9

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +77 -0
  2. clf (1).pkl +3 -0
  3. tfidf (1).pkl +3 -0
app.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+ import re
4
+ import nltk
5
+
6
+ nltk.download('punkt')
7
+ nltk.download('stopwords')
8
+
9
+ #loading models
10
+ clf = pickle.load(open('clf.pkl','rb'))
11
+ tfidfd = pickle.load(open('tfidf.pkl','rb'))
12
+
13
+ def clean_resume(resume_text):
14
+ clean_text = re.sub('http\S+\s*', ' ', resume_text)
15
+ clean_text = re.sub('RT|cc', ' ', clean_text)
16
+ clean_text = re.sub('#\S+', '', clean_text)
17
+ clean_text = re.sub('@\S+', ' ', clean_text)
18
+ clean_text = re.sub('[%s]' % re.escape("""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""), ' ', clean_text)
19
+ clean_text = re.sub(r'[^\x00-\x7f]', r' ', clean_text)
20
+ clean_text = re.sub('\s+', ' ', clean_text)
21
+ return clean_text
22
+ # web app
23
+ def main():
24
+ st.title("Resume Screening App")
25
+ uploaded_file = st.file_uploader('Upload Resume', type=['txt','pdf'])
26
+
27
+ if uploaded_file is not None:
28
+ try:
29
+ resume_bytes = uploaded_file.read()
30
+ resume_text = resume_bytes.decode('utf-8')
31
+ except UnicodeDecodeError:
32
+ # If UTF-8 decoding fails, try decoding with 'latin-1'
33
+ resume_text = resume_bytes.decode('latin-1')
34
+
35
+ cleaned_resume = clean_resume(resume_text)
36
+ input_features = tfidfd.transform([cleaned_resume])
37
+ prediction_id = clf.predict(input_features)[0]
38
+ st.write(prediction_id)
39
+
40
+ # Map category ID to category name
41
+ category_mapping = {
42
+ 15: "Java Developer",
43
+ 23: "Testing",
44
+ 8: "DevOps Engineer",
45
+ 20: "Python Developer",
46
+ 24: "Web Designing",
47
+ 12: "HR",
48
+ 13: "Hadoop",
49
+ 3: "Blockchain",
50
+ 10: "ETL Developer",
51
+ 18: "Operations Manager",
52
+ 6: "Data Science",
53
+ 22: "Sales",
54
+ 16: "Mechanical Engineer",
55
+ 1: "Arts",
56
+ 7: "Database",
57
+ 11: "Electrical Engineering",
58
+ 14: "Health and fitness",
59
+ 19: "PMO",
60
+ 4: "Business Analyst",
61
+ 9: "DotNet Developer",
62
+ 2: "Automation Testing",
63
+ 17: "Network Security Engineer",
64
+ 21: "SAP Developer",
65
+ 5: "Civil Engineer",
66
+ 0: "Advocate",
67
+ }
68
+
69
+ category_name = category_mapping.get(prediction_id, "Unknown")
70
+
71
+ st.write("Predicted Category:", category_name)
72
+
73
+
74
+
75
+ # python main
76
+ if __name__ == "__main__":
77
+ main()
clf (1).pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dedb019a2c7bf1ab603b9e798888350829b4acf06c6d32917c19195552501d8d
3
+ size 39000105
tfidf (1).pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75d3e75227cd6801487bd1130356c9310608aaff8197ed819ba8f2706836e7db
3
+ size 213493