Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,17 +12,17 @@ unique_values = saved_components['unique_values']
|
|
12 |
|
13 |
# Define the Streamlit app
|
14 |
def main():
|
15 |
-
st.title("Employee Attrition Prediction App")
|
16 |
-
st.sidebar.title("Model Settings")
|
17 |
|
18 |
# Sidebar inputs
|
19 |
-
with st.sidebar.expander("View Unique Values"):
|
20 |
st.write("Unique values for each feature:")
|
21 |
for column, values in unique_values.items():
|
22 |
st.write(f"- {column}: {values}")
|
23 |
|
24 |
# Main content
|
25 |
-
st.write("Welcome to the Employee Attrition Prediction App!")
|
26 |
st.write("This app helps HR practitioners predict employee attrition using a trained CatBoost model.")
|
27 |
st.write("Please provide the following information to make a prediction:")
|
28 |
|
@@ -55,7 +55,7 @@ def main():
|
|
55 |
years_with_curr_manager = st.number_input("Years With Current Manager")
|
56 |
|
57 |
# Predict button
|
58 |
-
if st.button("Predict"):
|
59 |
|
60 |
# Create a DataFrame to hold the user input data
|
61 |
input_data = pd.DataFrame({
|
@@ -84,16 +84,16 @@ def main():
|
|
84 |
# Make predictions
|
85 |
prediction = model.predict(input_data)
|
86 |
probability = model.predict_proba(input_data)[:, 1]
|
87 |
-
|
88 |
# Display prediction probability
|
89 |
if prediction[0] == 1:
|
90 |
-
st.subheader("Prediction Probability")
|
91 |
st.write(f"The probability of the employee leaving is: {probability[0]*100:.2f}%")
|
92 |
|
93 |
# Display characteristic-based recommendations
|
94 |
-
st.subheader("Recommendations for Retaining The Employee
|
95 |
if job_satisfaction == 1 or environment_satisfaction == 1:
|
96 |
-
st.markdown("- Enhance job and environment satisfaction through initiatives such as recognition programs and improving workplace conditions.")
|
97 |
if years_since_last_promotion > 5:
|
98 |
st.markdown("- Implement a transparent promotion policy and provide opportunities for career advancement.")
|
99 |
if years_with_curr_manager > 5:
|
|
|
12 |
|
13 |
# Define the Streamlit app
|
14 |
def main():
|
15 |
+
st.title("Employee Attrition Prediction App π΅οΈββοΈ")
|
16 |
+
st.sidebar.title("Model Settings βοΈ")
|
17 |
|
18 |
# Sidebar inputs
|
19 |
+
with st.sidebar.expander("View Unique Values π"):
|
20 |
st.write("Unique values for each feature:")
|
21 |
for column, values in unique_values.items():
|
22 |
st.write(f"- {column}: {values}")
|
23 |
|
24 |
# Main content
|
25 |
+
st.write("Welcome to the Employee Attrition Prediction App! π")
|
26 |
st.write("This app helps HR practitioners predict employee attrition using a trained CatBoost model.")
|
27 |
st.write("Please provide the following information to make a prediction:")
|
28 |
|
|
|
55 |
years_with_curr_manager = st.number_input("Years With Current Manager")
|
56 |
|
57 |
# Predict button
|
58 |
+
if st.button("Predict π"):
|
59 |
|
60 |
# Create a DataFrame to hold the user input data
|
61 |
input_data = pd.DataFrame({
|
|
|
84 |
# Make predictions
|
85 |
prediction = model.predict(input_data)
|
86 |
probability = model.predict_proba(input_data)[:, 1]
|
87 |
+
|
88 |
# Display prediction probability
|
89 |
if prediction[0] == 1:
|
90 |
+
st.subheader("Prediction Probability π")
|
91 |
st.write(f"The probability of the employee leaving is: {probability[0]*100:.2f}%")
|
92 |
|
93 |
# Display characteristic-based recommendations
|
94 |
+
st.subheader("Recommendations for Retaining The Employee π‘:")
|
95 |
if job_satisfaction == 1 or environment_satisfaction == 1:
|
96 |
+
st.markdown("- **Job and Environment Satisfaction**: Enhance job and environment satisfaction through initiatives such as recognition programs and improving workplace conditions.")
|
97 |
if years_since_last_promotion > 5:
|
98 |
st.markdown("- Implement a transparent promotion policy and provide opportunities for career advancement.")
|
99 |
if years_with_curr_manager > 5:
|