Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import joblib
|
| 3 |
+
|
| 4 |
+
# load the model
|
| 5 |
+
model = joblib.load("Tesla_Elon_Regression_Model.pkl")
|
| 6 |
+
|
| 7 |
+
# Load the model information
|
| 8 |
+
model_info = joblib.load("model_info.pkl")
|
| 9 |
+
|
| 10 |
+
st.title("Predict developer paycheck")
|
| 11 |
+
st.write("Predict developer salaries based on a Stack Overflow dataset")
|
| 12 |
+
|
| 13 |
+
feature_values = {}
|
| 14 |
+
for feature in model_info["features"]:
|
| 15 |
+
if feature is "yearsCode" or feature is "yearsCodePro":
|
| 16 |
+
feature_values[feature] = st.number_input(f"Enter {feature}", min_value=0.0)
|
| 17 |
+
else:
|
| 18 |
+
feature_values[feature] = st.text_input(f"Enter {feature}")
|
| 19 |
+
|
| 20 |
+
if st.button("Predict Salary"):
|
| 21 |
+
input_features = [feature_values[feature] for feature in model_info["features"]]
|
| 22 |
+
prediction = model.predict([input_features])[0]
|
| 23 |
+
st.write(f"Predicted Stock Price: {prediction[0]}")
|