Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
import pickle
|
3 |
import pandas as pd
|
@@ -10,6 +11,51 @@ with open('model_and_key_components.pkl', 'rb') as file:
|
|
10 |
model = saved_components['model']
|
11 |
unique_values = saved_components['unique_values']
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Define the Streamlit app
|
14 |
def main():
|
15 |
st.title("Employee Attrition Prediction App π΅οΈββοΈ")
|
@@ -55,7 +101,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({
|
|
|
1 |
+
#Import Relevant Libraries
|
2 |
import streamlit as st
|
3 |
import pickle
|
4 |
import pandas as pd
|
|
|
11 |
model = saved_components['model']
|
12 |
unique_values = saved_components['unique_values']
|
13 |
|
14 |
+
# Page Title with Style
|
15 |
+
st.markdown(
|
16 |
+
f"""
|
17 |
+
<div style="text-align: center;">
|
18 |
+
<h1 style="color: #800000;">π₯ Employee Attrition Prediction App</h1>
|
19 |
+
</div>
|
20 |
+
""",
|
21 |
+
unsafe_allow_html=True
|
22 |
+
)
|
23 |
+
|
24 |
+
# Welcome Message with Style (Centered)
|
25 |
+
st.markdown(
|
26 |
+
f"""
|
27 |
+
<div style="text-align: center;">
|
28 |
+
<p>π Welcome to the Employee Attrition Prediction App!</p>
|
29 |
+
</div>
|
30 |
+
""",
|
31 |
+
unsafe_allow_html=True
|
32 |
+
)
|
33 |
+
|
34 |
+
# Sepsis Information
|
35 |
+
st.markdown(
|
36 |
+
"""
|
37 |
+
**Employee attrition** refers to the phenomenon of employees leaving their jobs for various reasons. It's crucial for organizations to predict attrition to retain valuable talent.
|
38 |
+
"""
|
39 |
+
)
|
40 |
+
|
41 |
+
# Link to Detailed Article on Employee Attrition
|
42 |
+
st.markdown("π **Learn more about employee attrition from [AIHR](https://www.aihr.com/wp-content/uploads/Reasons-for-Employee-Attrition.png)**")
|
43 |
+
|
44 |
+
st.markdown("---")
|
45 |
+
|
46 |
+
# Main content
|
47 |
+
st.image("https://www.aihr.com/wp-content/uploads/Reasons-for-Employee-Attrition.png")
|
48 |
+
|
49 |
+
# Additional Information for Sample Prediction
|
50 |
+
st.write("π To make a sample prediction, you can refer to the training dataset information available in the sidebar or input the information of the employee whose attrition you want to predict.")
|
51 |
+
|
52 |
+
# About Section with Style
|
53 |
+
st.sidebar.title("βΉοΈ About")
|
54 |
+
st.sidebar.info(
|
55 |
+
"This app predicts employee attrition using machine learning on HR data, aiding HR professionals in retention strategies. "
|
56 |
+
"It utilizes a machine learning model trained on an employee attrition dataset."
|
57 |
+
)
|
58 |
+
|
59 |
# Define the Streamlit app
|
60 |
def main():
|
61 |
st.title("Employee Attrition Prediction App π΅οΈββοΈ")
|
|
|
101 |
years_with_curr_manager = st.number_input("Years With Current Manager")
|
102 |
|
103 |
# Predict button
|
104 |
+
if st.button("Predict Employee Attrition π"):
|
105 |
|
106 |
# Create a DataFrame to hold the user input data
|
107 |
input_data = pd.DataFrame({
|