Spaces:
Runtime error
Runtime error
Basanth
commited on
Commit
·
e5d2c3b
1
Parent(s):
d72b2f5
updatev2
Browse files- apps/demo.py +45 -88
- src/__pycache__/gauge_components.cpython-38.pyc +0 -0
- src/file_uploader.py +1 -1
- src/gauge_components.py +64 -0
apps/demo.py
CHANGED
@@ -6,100 +6,52 @@ from annotated_text import annotated_text, annotation
|
|
6 |
from src.utils import load_skill_extractor, create_dfs
|
7 |
from src.utils import clean_text, predict_cat, load_model,get_match
|
8 |
from src.file_uploader import extract_text_from_file,get_file_type
|
|
|
9 |
|
10 |
|
11 |
model = load_model()
|
12 |
skill_extractor = load_skill_extractor()
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
def app():
|
18 |
-
|
|
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
#file upload widget
|
22 |
-
uploaded_file = st.file_uploader("Choose a file",type =['pdf','docx'])
|
23 |
-
text = ''
|
24 |
-
if uploaded_file is not None:
|
25 |
-
text = extract_text_from_file(uploaded_file)
|
26 |
-
|
27 |
-
|
28 |
-
st.title("Uploaded resume ")
|
29 |
-
with st.form(key="text_val"):
|
30 |
-
if text is not None:
|
31 |
-
default_text = text
|
32 |
-
input_text = st.text_area('', value=default_text, height=200)
|
33 |
-
submit_button = st.form_submit_button(label="Submit")
|
34 |
|
35 |
-
cls_text = clean_text(input_text)
|
36 |
-
# st.write(cls_text)
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
"
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
},
|
57 |
-
"progress": {
|
58 |
-
"show": True,
|
59 |
-
"overlap": False,
|
60 |
-
"roundCap":False,
|
61 |
-
"clip": False,
|
62 |
-
"backgroundColor": '#11D1F9',
|
63 |
-
"itemStyle": {
|
64 |
-
"color": '#E96605',
|
65 |
-
"borderWidth": 0,
|
66 |
-
"borderColor": "light blue"
|
67 |
-
}
|
68 |
-
},
|
69 |
-
"axisLine": {
|
70 |
-
"lineStyle": {
|
71 |
-
"width": 40
|
72 |
-
}
|
73 |
-
},
|
74 |
-
"splitLine": {
|
75 |
-
"show": False,
|
76 |
-
"distance": 0,
|
77 |
-
"length": 20
|
78 |
-
},
|
79 |
-
"axisTick": {
|
80 |
-
"show": False
|
81 |
-
},
|
82 |
-
"axisLabel": {
|
83 |
-
"show": False,
|
84 |
-
"distance": 50
|
85 |
-
},
|
86 |
-
"data": gaugeData,
|
87 |
-
"detail": {
|
88 |
-
"valueAnimation": True,
|
89 |
-
"offsetCenter": ['0%', '0%'],
|
90 |
-
"width": 40,
|
91 |
-
"height": 14,
|
92 |
-
"fontSize": 24,
|
93 |
-
"color": 'inherit',
|
94 |
-
"borderColor": 'inherit',
|
95 |
-
"borderRadius": 0,
|
96 |
-
"borderWidth": 0,
|
97 |
-
"formatter": '{value}%'
|
98 |
-
},
|
99 |
-
}
|
100 |
-
]
|
101 |
-
}
|
102 |
-
|
103 |
prob,job_cat = predict_cat(model, cls_text)
|
104 |
annotations = skill_extractor.annotate(cls_text,tresh=1)
|
105 |
text = annotations['text']
|
@@ -107,9 +59,10 @@ def app():
|
|
107 |
df = create_dfs(annotations)
|
108 |
match = get_match(job_cat,df)
|
109 |
|
110 |
-
|
|
|
111 |
with st.form(key='result'):
|
112 |
-
if
|
113 |
gaugeData[0]['value']=match
|
114 |
with col1:
|
115 |
st.markdown(f"""<h1 style= "text-align: -webkit-center;font-family: sans-serif;">Job Category</h1>""", unsafe_allow_html=True)
|
@@ -144,6 +97,10 @@ def app():
|
|
144 |
# st.markdown('-----------')
|
145 |
df = create_dfs(annotations)
|
146 |
st.markdown(f"""<h1 style= "text-align: -webkit-center;font-family: sans-serif;">Extracted Skill</h1>""",unsafe_allow_html=True)
|
147 |
-
st.write(", \n".join(df))
|
|
|
148 |
|
149 |
-
|
|
|
|
|
|
|
|
6 |
from src.utils import load_skill_extractor, create_dfs
|
7 |
from src.utils import clean_text, predict_cat, load_model,get_match
|
8 |
from src.file_uploader import extract_text_from_file,get_file_type
|
9 |
+
from src. gauge_components import gauge
|
10 |
|
11 |
|
12 |
model = load_model()
|
13 |
skill_extractor = load_skill_extractor()
|
14 |
|
|
|
|
|
|
|
15 |
def app():
|
16 |
+
if 'input_text' not in st.session_state:
|
17 |
+
st.session_state['input_text'] = ''
|
18 |
|
19 |
+
st.markdown(f"""<h1
|
20 |
+
style= "text-align:-webkit-center;
|
21 |
+
font-size: xx-large;
|
22 |
+
font-weight: bold;
|
23 |
+
font-family:sans-serif;">
|
24 |
+
Compare resume skills to the top skills of industry
|
25 |
+
</h1>""", unsafe_allow_html=True)
|
26 |
+
|
27 |
+
st.markdown("""<h1
|
28 |
+
style= "text-align:-webkit-center;
|
29 |
+
font: caption;
|
30 |
+
font-family:sans-serif;">
|
31 |
+
Match your resume skills to top industry skills,
|
32 |
+
identify skill gaps, and prioritize development
|
33 |
+
</h1>""",unsafe_allow_html=True)
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
|
|
|
|
36 |
|
37 |
+
|
38 |
+
|
39 |
+
uploaded_file = st.file_uploader("Choose a file",type =['pdf','docx'],label_visibility = "collapsed")
|
40 |
+
if uploaded_file is not None:
|
41 |
+
st.session_state['input_text'] = extract_text_from_file(uploaded_file)
|
42 |
+
else:
|
43 |
+
st.session_state['input_text'] = ''
|
44 |
+
|
45 |
+
|
46 |
+
# st.title("Uploaded resume ")
|
47 |
+
# with st.form(key="text_val"):
|
48 |
+
# if text is not None:
|
49 |
+
# default_text = text
|
50 |
+
# # input_text = st.text_area('', value=default_text, height=200)
|
51 |
+
# submit_button = st.form_submit_button(label="Submit")
|
52 |
+
|
53 |
+
|
54 |
+
cls_text = clean_text(st.session_state['input_text'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
prob,job_cat = predict_cat(model, cls_text)
|
56 |
annotations = skill_extractor.annotate(cls_text,tresh=1)
|
57 |
text = annotations['text']
|
|
|
59 |
df = create_dfs(annotations)
|
60 |
match = get_match(job_cat,df)
|
61 |
|
62 |
+
col1, col2,= st.columns(2)
|
63 |
+
gaugeData,option = gauge(value=0)
|
64 |
with st.form(key='result'):
|
65 |
+
if st.session_state['input_text']:
|
66 |
gaugeData[0]['value']=match
|
67 |
with col1:
|
68 |
st.markdown(f"""<h1 style= "text-align: -webkit-center;font-family: sans-serif;">Job Category</h1>""", unsafe_allow_html=True)
|
|
|
97 |
# st.markdown('-----------')
|
98 |
df = create_dfs(annotations)
|
99 |
st.markdown(f"""<h1 style= "text-align: -webkit-center;font-family: sans-serif;">Extracted Skill</h1>""",unsafe_allow_html=True)
|
100 |
+
st.write(", \n".join(df))
|
101 |
+
|
102 |
|
103 |
+
|
104 |
+
|
105 |
+
#file upload widget
|
106 |
+
|
src/__pycache__/gauge_components.cpython-38.pyc
ADDED
Binary file (1.04 kB). View file
|
|
src/file_uploader.py
CHANGED
@@ -35,7 +35,7 @@ def extract_text_from_file(uploaded_file):
|
|
35 |
return doc2text(io.BytesIO(uploaded_file.read()))
|
36 |
else:
|
37 |
st.warning("plese upload the correct file type")
|
38 |
-
return
|
39 |
|
40 |
def main():
|
41 |
uploaded_file = st.file_uploader("Choose a file", type=['pdf', 'docx', 'doc'])
|
|
|
35 |
return doc2text(io.BytesIO(uploaded_file.read()))
|
36 |
else:
|
37 |
st.warning("plese upload the correct file type")
|
38 |
+
return ""
|
39 |
|
40 |
def main():
|
41 |
uploaded_file = st.file_uploader("Choose a file", type=['pdf', 'docx', 'doc'])
|
src/gauge_components.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def gauge(value):
|
2 |
+
gaugeData = [{
|
3 |
+
"value": 0,
|
4 |
+
"name": 'Match %',
|
5 |
+
"detail": {
|
6 |
+
"valueAnimation": True,
|
7 |
+
"offsetCenter": ['0%', '0%']
|
8 |
+
}
|
9 |
+
}]
|
10 |
+
option = {
|
11 |
+
"series": [
|
12 |
+
{
|
13 |
+
"type": "gauge",
|
14 |
+
"startAngle": 90,
|
15 |
+
"endAngle": -270,
|
16 |
+
"pointer": {
|
17 |
+
"show": False,
|
18 |
+
},
|
19 |
+
"progress": {
|
20 |
+
"show": True,
|
21 |
+
"overlap": False,
|
22 |
+
"roundCap":False,
|
23 |
+
"clip": False,
|
24 |
+
"backgroundColor": '#11D1F9',
|
25 |
+
"itemStyle": {
|
26 |
+
"color": '#E96605',
|
27 |
+
"borderWidth": 0,
|
28 |
+
"borderColor": "light blue"
|
29 |
+
}
|
30 |
+
},
|
31 |
+
"axisLine": {
|
32 |
+
"lineStyle": {
|
33 |
+
"width": 40
|
34 |
+
}
|
35 |
+
},
|
36 |
+
"splitLine": {
|
37 |
+
"show": False,
|
38 |
+
"distance": 0,
|
39 |
+
"length": 20
|
40 |
+
},
|
41 |
+
"axisTick": {
|
42 |
+
"show": False
|
43 |
+
},
|
44 |
+
"axisLabel": {
|
45 |
+
"show": False,
|
46 |
+
"distance": 50
|
47 |
+
},
|
48 |
+
"data": gaugeData,
|
49 |
+
"detail": {
|
50 |
+
"valueAnimation": True,
|
51 |
+
"offsetCenter": ['0%', '0%'],
|
52 |
+
"width": 40,
|
53 |
+
"height": 14,
|
54 |
+
"fontSize": 24,
|
55 |
+
"color": 'inherit',
|
56 |
+
"borderColor": 'inherit',
|
57 |
+
"borderRadius": 0,
|
58 |
+
"borderWidth": 0,
|
59 |
+
"formatter": '{value}%'
|
60 |
+
},
|
61 |
+
}
|
62 |
+
]
|
63 |
+
}
|
64 |
+
return gaugeData ,option
|