File size: 810 Bytes
b135c67
 
8c474e5
b135c67
 
188f89d
b135c67
 
 
 
188f89d
b135c67
 
 
 
188f89d
b135c67
 
188f89d
b135c67
 
 
 
c95da78
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import streamlit as st
import joblib
import math

# load the model
model = joblib.load("Coder-Paycheck-Predict-Model.pkl")

# Load the model information
model_info = joblib.load("model_info.pkl")

st.title("Predict Developer Salary")
st.write("Predict developer salaries based on a Stack Overflow dataset")

feature_values = {}
for feature in model_info["features"]:
    if feature == "YearsCode" or feature == "YearsCodePro":
        feature_values[feature] = st.number_input(f"Enter {feature}", min_value=0.0)
    else:
        feature_values[feature] = st.checkbox(f"{feature}")

if st.button("Predict Salary"):
    input_features = [feature_values[feature] for feature in model_info["features"]]
    prediction = model.predict([input_features])[0]
    st.write(f"Predicted annual salary: ${prediction[0]}")