-
Notifications
You must be signed in to change notification settings - Fork 0
/
comp_app.py
112 lines (97 loc) · 2.64 KB
/
comp_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
import streamlit as st
import pandas as pd
from joblib import load
model = load("/app/rbf_model.joblib")
def show_predict_page():
st.title("Engineering Compensation Prediction")
st.write("""### We need some information to predict the compensation""")
job_name = st.text_input("Job name", "e.g. data scientist")
countries = (
"United States",
"India" ,
"United Kingdom",
"Other" ,
"Canada" ,
"Austria",
"Brazil" ,
"France",
"Germany",
"Australia",
"South Africa",
"Romania",
"China",
"Netherlands",
"Lithuania",
"Mexico" ,
"Singapore",
"Israel",
"Spain" ,
"Italy",
"Japan" ,
"New Zealand",
"Philippines",
"Argentina",
"Poland",
"Malaysia",
"Ireland",
"Cuba",
)
education = (
"Unclear",
"Bachelors",
"High School",
"Some High School",
"Masters",
"Doctorate",
"Associates",
"Vocational",
"No Education Requirement",
)
hours = (
"Full-Time",
"Unclear",
"Part-Time",
"Contract",
"Hourly",
"Intern" ,
"Temp",
)
seniorities = (
"Unclear Seniority",
"Senior IC",
"Manager",
"IC",
"Junior IC",
"Staff IC",
"Intern",
"Director",
"Chief",
"Contract",
"Exec",
"Senior Manager",
)
remote_opts = (
"Unclear",
"true",
"false",
)
hour = st.selectbox("Hours", hours)
remote = st.selectbox("Remote", remote_opts)
education = st.selectbox("Education Level", education)
seniority = st.selectbox("Seniority", seniorities)
country = st.selectbox("Country", countries)
ok = st.button("Calculate Compensation Estimation")
if ok:
df_predict = pd.DataFrame({
"job_name": [job_name],
"hours": [hour],
"remote": [remote],
"education": [education],
"seniority":[seniority],
"country":[country],
})
estimation = model.predict(df_predict)
scaler_loaded = load('/app/scaler.joblib')
salary = scaler_loaded.inverse_transform([estimation])
st.subheader(f"The estimated salary is ${salary[0][0]:,.0f}")
show_predict_page()