Spaces:
Sleeping
Sleeping
Commit
·
41c6ff1
1
Parent(s):
8c4a43d
classifying the resume with job profile
Browse files- app.py +42 -0
- label.json +25 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoModel
|
2 |
+
import torch
|
3 |
+
import pandas as pd
|
4 |
+
import numpy as np
|
5 |
+
import streamlit as st
|
6 |
+
import json
|
7 |
+
|
8 |
+
|
9 |
+
def intial_load():
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained("LijinDurairaj/classify_resume_model")
|
11 |
+
model = AutoModelForSequenceClassification.from_pretrained("LijinDurairaj/classify_resume_model")
|
12 |
+
return tokenizer,model
|
13 |
+
|
14 |
+
def load_labels():
|
15 |
+
with open('./label.json','r') as file:
|
16 |
+
data=json.load(file)
|
17 |
+
return data
|
18 |
+
|
19 |
+
tokenizer,model=intial_load()
|
20 |
+
labels=load_labels()
|
21 |
+
|
22 |
+
st.title('classifying resume')
|
23 |
+
|
24 |
+
resume = st.text_area(label='resume',placeholder='paste your resume here...')
|
25 |
+
|
26 |
+
if st.button('Submit'):
|
27 |
+
resume_list=[]
|
28 |
+
resume_list.append(resume)
|
29 |
+
|
30 |
+
tokenized_data=tokenizer.batch_encode_plus(
|
31 |
+
resume_list,
|
32 |
+
max_length=512,
|
33 |
+
truncation=True,
|
34 |
+
return_tensors='pt'
|
35 |
+
)
|
36 |
+
with torch.no_grad():
|
37 |
+
prediction=model(**tokenized_data)
|
38 |
+
predicted_label=np.argmax(prediction[0].view(-1))
|
39 |
+
profile=[d for d,i in labels.items() if i==predicted_label.item()][0]
|
40 |
+
st.success(f'The uploaded resume is fit for the following role: {profile}')
|
41 |
+
|
42 |
+
|
label.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"TEACHER": 0,
|
3 |
+
"INFORMATION-TECHNOLOGY": 1,
|
4 |
+
"APPAREL": 2,
|
5 |
+
"FINANCE": 3,
|
6 |
+
"ENGINEERING": 4,
|
7 |
+
"BANKING": 5,
|
8 |
+
"CONSULTANT": 6,
|
9 |
+
"DESIGNER": 7,
|
10 |
+
"DIGITAL-MEDIA": 8,
|
11 |
+
"ACCOUNTANT": 9,
|
12 |
+
"AVIATION": 10,
|
13 |
+
"CHEF": 11,
|
14 |
+
"AUTOMOBILE": 12,
|
15 |
+
"BPO": 13,
|
16 |
+
"ADVOCATE": 14,
|
17 |
+
"BUSINESS-DEVELOPMENT": 15,
|
18 |
+
"HEALTHCARE": 16,
|
19 |
+
"FITNESS": 17,
|
20 |
+
"AGRICULTURE": 18,
|
21 |
+
"CONSTRUCTION": 19,
|
22 |
+
"SALES": 20,
|
23 |
+
"PUBLIC-RELATIONS": 21,
|
24 |
+
"HR": 22,
|
25 |
+
"ARTS": 23}
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
torch
|