File size: 2,394 Bytes
8c7877c
 
 
 
5e9d356
 
 
 
8c7877c
0d943ce
7b2175c
 
 
760698e
0d943ce
 
 
 
 
5e9d356
8c7877c
 
 
dd050b2
 
 
 
 
8c7877c
 
dd050b2
8c7877c
 
dd050b2
4a4fc1a
dd050b2
 
 
8c7877c
 
dd050b2
8c7877c
5f964ea
70d1698
dd050b2
0d943ce
5f964ea
8c7877c
dd050b2
6ffdadf
8c7877c
 
 
 
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
import joblib
import pandas as pd
import streamlit as st

Experience_dict = {'Entry-level':1,
            'Mid-level':2,
            'Senior-level':3,
            'Executive-level':4
            }
            
Company_size_dict = {'Small, less than 50 employees':1,
            'Medium, 50 to 250 employees':2,
            'Large, more than 250 employees':3
            }
            
remote_ratio_dict = {'No remote work':1,
                     'Partially remote':2,
                     'Fully remote':3
                     }
                              
model = joblib.load('model.joblib')
unique_values = joblib.load('unique_values.joblib')
    
unique_experience_level =  unique_values["experience_level"]
unique_employment_type =  unique_values["employment_type"]
unique_job_title =  unique_values["job_title"]
unique_remote_ratio =  unique_values["remote_ratio"]
unique_company_size =  unique_values["company_size"]

def main():
    st.title("Data Science Job Salaries")

    with st.form("questionaire"):
        experience_level = st.selectbox("The experience level in the job", options = unique_experience_level)
        employment_type = st.selectbox("The type of employment for the role", options=unique_employment_type)
        job_title = st.selectbox("The role worked", options=unique_job_title)
        remote_ratio = st.selectbox("The overall amount of work done remotely", options=unique_remote_ratio)
        company_size = st.selectbox("The average number of people that worked for the company", options=unique_company_size)

        # clicked==True only when the button is clicked
        clicked = st.form_submit_button("Predict Data Science Job Salaries")
        if clicked:
            result=model.predict(pd.DataFrame({"experience_level": [Experience_dict[experience_level]],
                                               "employment_type" : [employment_type],
                                               "job_title": [job_title],
                                               "remote_ratio": [remote_ratio_dict[remote_ratio]],
                                               "company_size": [Company_size_dict[company_size]]}))
            # Show prediction
            salary_in_usd = str(round(float(result),2))
            st.success("Your predicted Data Science job salaries in USD is "+salary_in_usd)
            
if __name__ == "__main__":
    main()