Spaces:
Build error
Build error
Download app.py from wiaandev/Coder-Paycheck-Predict-Model: direct link, hf CLI and curl.
- Browser
- Download file 810 Bytes
-
https://huggingface.co/spaces/wiaandev/Coder-Paycheck-Predict-Model/resolve/main/app.py
- Command line
-
hf download hf://spaces/wiaandev/Coder-Paycheck-Predict-Model/app.py
-
curl -L -o app.py https://huggingface.co/spaces/wiaandev/Coder-Paycheck-Predict-Model/resolve/main/app.py
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]}") |