Commit
·
9c693e1
1
Parent(s):
e7abd6b
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import pickle
|
4 |
+
import streamlit.components.v1 as components
|
5 |
+
|
6 |
+
# Load the pickled model
|
7 |
+
def load_model():
|
8 |
+
return pickle.load(open('Employee_Turnover_prognosis_RandomForest.pkl', 'rb'))
|
9 |
+
|
10 |
+
# Function for model prediction
|
11 |
+
def model_prediction(model, features):
|
12 |
+
predicted = str(model.predict(features)[0])
|
13 |
+
return predicted
|
14 |
+
|
15 |
+
def app_design():
|
16 |
+
# Add input fields for High, Open, and Low values
|
17 |
+
image = '14.png'
|
18 |
+
st.image(image, use_column_width=True)
|
19 |
+
|
20 |
+
st.subheader("Enter the following values:")
|
21 |
+
|
22 |
+
|
23 |
+
Stag = st.number_input("Stag")
|
24 |
+
Gender = st.selectbox('Gender',('Male','Female'))
|
25 |
+
if Gender == 'Male':
|
26 |
+
Gender = 1
|
27 |
+
elif Gender == 'Female':
|
28 |
+
Gender = 0
|
29 |
+
Age = st.number_input("Age")
|
30 |
+
Industry = st.number_input("Industry")
|
31 |
+
Profession = st.number_input("Profession")
|
32 |
+
Traffic = st.number_input("Traffic")
|
33 |
+
Coach = st.number_input("Coach")
|
34 |
+
Head_gender = st.select_slider("Head Gender",('Male','Female'))
|
35 |
+
if Head_gender == 'Male':
|
36 |
+
Gender = 0
|
37 |
+
elif Head_gender == 'Female':
|
38 |
+
Gender = 1
|
39 |
+
Greywage = st.number_input("Greywage")
|
40 |
+
Way = st.number_input("Way")
|
41 |
+
Extraversion = st.number_input("Extraversion")
|
42 |
+
Independ = st.number_input("Independ")
|
43 |
+
Selfcontrol = st.number_input("Selfcontrol")
|
44 |
+
Anxiety = st.number_input("Anxiety")
|
45 |
+
Novator = st.number_input("Novator")
|
46 |
+
|
47 |
+
|
48 |
+
# Create a feature list from the user inputs
|
49 |
+
features = [Stag,Gender,Age,Industry,Profession,Traffic,Coach,Head_gender,Greywage,Way,Extraversion,Independ,Selfcontrol,Anxiety,Novator]
|
50 |
+
|
51 |
+
# Load the model
|
52 |
+
model = load_model()
|
53 |
+
|
54 |
+
# Make a prediction when the user clicks the "Predict" button
|
55 |
+
if st.button('Predict Turnover'):
|
56 |
+
predicted_value = model_prediction(model, features)
|
57 |
+
st.success(f"The Employee Turnover is: {predicted_value}")
|
58 |
+
|
59 |
+
|
60 |
+
def about_hidevs():
|
61 |
+
|
62 |
+
components.html("""
|
63 |
+
<div>
|
64 |
+
<h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
|
65 |
+
<p class="subtitle">🔍 Seeking the perfect job? HiDevs Community is your gateway to career success in the tech industry. Explore free expert courses, job-seeking support, and career transformation tips.</p>
|
66 |
+
<p class="subtitle">💼 We offer an upskill program in <b>Gen AI, Data Science, Machine Learning</b>, and assist startups in adopting <b>Gen AI</b> at minimal development costs.</p>
|
67 |
+
<p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
|
68 |
+
<p class="subtitle">Book free of cost 1:1 mentorship on any topic of your choice — <a class="link" href="https://topmate.io/deepakchawla1307">topmate</a></p>
|
69 |
+
<p class="subtitle">✨ We dedicate over 30 minutes to each applicant’s resume, LinkedIn profile, mock interview, and upskill program. If you’d like our guidance, check out our services <a class="link" href="https://hidevscommunity.wixsite.com/hidevs">here</a></p>
|
70 |
+
<p class="subtitle">💡 Join us now, and turbocharge your career!</p>
|
71 |
+
<p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
|
72 |
+
<a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
|
73 |
+
<a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
|
74 |
+
<a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
|
75 |
+
<a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
|
76 |
+
<a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
|
77 |
+
</div>
|
78 |
+
""",
|
79 |
+
height=600)
|
80 |
+
|
81 |
+
def main():
|
82 |
+
|
83 |
+
# Set the app title and add your website name and logo
|
84 |
+
st.set_page_config(
|
85 |
+
page_title="Employee Attrition Prediction",
|
86 |
+
page_icon=":chart_with_upwards_trend:",
|
87 |
+
)
|
88 |
+
|
89 |
+
st.title("Welcome to our Employee Attrition Prediction App!")
|
90 |
+
|
91 |
+
app_design()
|
92 |
+
st.header("About HiDevs Community")
|
93 |
+
about_hidevs()
|
94 |
+
|
95 |
+
if __name__ == '__main__':
|
96 |
+
main()
|