-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpredict_salary.py
64 lines (45 loc) · 1.45 KB
/
predict_salary.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
import streamlit as st
from pycaret.regression import *
import pandas as pd
def show_predict_page():
st.title("Software Developer Salary Prediction")
st.write("""### We need some information to predict the salary""")
countries = (
"United States",
"India",
"United Kingdom",
"Germany",
"Canada",
"Brazil",
"France",
"Spain",
"Australia",
"Netherlands",
"Poland",
"Italy",
"Russian Federation",
"Sweden",
)
education = (
"Less than a Bachelors",
"Bachelor’s degree",
"Master’s degree",
"Post grad",
)
professional = (
'proffesional',
'non professional'
)
country = st.selectbox("Country", countries)
education = st.selectbox("Education Level", education)
proffessional = st.selectbox('Proffesional Level', professional)
expericence = st.slider("Years of Experience", 0, 50, 3)
ok = st.button("Calculate Salary")
model = load_model('Final_Model')
features ={'Country': country, 'EdLevel': education ,
'YearsCodePro': expericence, 'MainBranch': proffessional}
features_df = pd.DataFrame([features])
if ok:
salary = predict_model(model, data=features_df)
st.subheader(f"The estimated salary is ${salary['Label'][0]:.2f}")
show_predict_page()