|
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 = 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]]})) |
|
|
|
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() |
|
|
|
|