jr98rh's picture
Update app.py
07f2c5b verified
import streamlit as st
import numpy as np
import pandas as pd
import joblib
import pickle
model = pickle.load(open("PycaretGBR.pkl", 'rb'))
# model = joblib.load("lr.joblib")
st.title('Developer Salary Prediction 2024')
st.write("""### We need some information to predict the salary""")
countries = (
"Australia",
"Austria",
"Belgium",
"Brazil",
"Canada",
"Czech Republic",
"Denmark",
"France",
"Germany",
"India",
"Israel",
"Italy",
"Netherlands",
"Norway",
"Poland",
"Russian Federation",
"Spain",
"Sweden",
"Switzerland",
"Ukraine"
"United Kingdom of Great Britain and Northern Ireland",
"United States of America"
)
education = (
"Less than a Bachelors",
"Bachelor’s degree",
"Master’s degree",
"Post grad"
)
employment = (
"Employed, full-time",
"Independent contractor, freelancer, or self-employed",
"Student, part-time",
"Retired",
"Not employed, but looking for work",
"Employed, part-time",
"Student, full-time"
)
country = st.selectbox("Country", countries)
education = st.selectbox("Education Level", education)
expericence = st.slider("Years of Experience", 0, 50, 3)
employment = st.selectbox("Employment Type", employment)
columns = ['Country', 'EdLevel', 'YearsCodePro', 'Employment']
ok = st.button("Calculate Salary")
if ok:
X_new_df = pd.DataFrame([[country,education,expericence,employment]],
columns = ['Country', 'EdLevel', 'YearsCodePro', 'Employment'])
print("##########")
print("##########")
print("##########")
print(model)
print("##########")
print("##########")
print("##########")
salary = model.predict(X_new_df)
st.subheader(f"The estimated salary is {salary[0]:.2f} $")\