wiaandev's picture
Update app.py
c95da78
raw
history blame contribute delete
No virus
810 Bytes
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]}")