Spaces:
Runtime error
Runtime error
import pandas as pd | |
import numpy as np | |
import streamlit as st | |
import joblib | |
from sklearn.linear_model import LinearRegression | |
model = joblib.load('DeveloperSalary/DeveloperSalary_Pred_Rgs.joblib') | |
st.title('Salary prediction in 2022') | |
st.write("""### fill the form for prediction""") | |
columns = ['Country', 'EdLevel', 'YearsCode'] | |
Country = st.selectbox('Chose your country', ['United States of America', 'Australia', 'Russian Federation', | |
'France', 'South Africa', 'Greece', 'Poland', 'Germany', 'Denmark', | |
'India', 'United Kingdom of Great Britain and Northern Ireland', | |
'Argentina', 'Hungary', 'Switzerland', 'Brazil', 'Italy', 'Spain', | |
'Iran, Islamic Republic of...', 'Bangladesh', 'Israel', 'Sweden', | |
'Portugal', 'Netherlands', 'Canada', 'Mexico', 'Austria', 'Norway', | |
'Finland', 'Czech Republic', 'Belgium', 'Turkey', 'Romania', | |
'Ukraine', 'Colombia', 'New Zealand', 'Ireland', 'Pakistan', | |
'Japan']) | |
EdLevel = st.selectbox('What is your educational level ?', ['Master’s degree', 'Bachelor’s degree', 'Less than a Bachelors', | |
'Post grad']) | |
YearsOfCode = st.slider('How many years have you been coding ?', 0, 100) | |
ok = st.button('Pred Salary') | |
if ok: | |
rows = np.array([Country, EdLevel, YearsOfCode]) | |
X_new = pd.DataFrame([rows], columns=columns) | |
Salary = model.predict(X_new) | |
st.subheader(f'The estimate salary is ${Salary[0]:.2f}') |