import streamlit as st import numpy as np import pickle import streamlit.components.v1 as components # Load the pickled model def load_model(): return pickle.load(open('Employee_Attrition_ra.pkl', 'rb')) # Function for model prediction def model_prediction(model, features): predicted = str(model.predict(features)[0]) return predicted def app_design(): # Add input fields for High, Open, and Low values image = '13.png' st.image(image, use_column_width=True) st.subheader("Enter the following values:") Age = st.number_input("Age") BusinessTravel = st.number_input("Business Travel") DailyRate = st.number_input("Daily Rate") Department = st.number_input("Department") DistanceFromHome = st.number_input("Distance From Home") Education = st.number_input("Education") EducationField = st.number_input("Education Field") EmployeeCount = st.number_input("Employee Count") EmployeeNumber = st.number_input("Employee Number") EnvironmentSatisfaction = st.number_input("Environment Satisfaction") Gender = st.selectbox('Gender',('Male','Female')) if Gender == 'Male': Gender = 0 elif Gender == 'Female': Gender = 1 HourlyRate = st.number_input("Hourly Rate") JobInvolvement = st.number_input("Job Involvement") JobLevel = st.number_input("Job Level") JobRole = st.number_input("Job Role") JobSatisfaction = st.number_input("JobSatisfaction") MaritalStatus = st.number_input("Marital Status") MonthlyIncome = st.number_input("Monthly Income") MonthlyRate = st.number_input("Monthly Rate") NumCompaniesWorked = st.number_input("Number of Companies in you worked") Over18 = st.number_input("Over 18 age") OverTime = st.number_input("Overtime hours") PercentSalaryHike = st.number_input("Percent Salary Hike") PerformanceRating = st.number_input("Performance Rating") RelationshipSatisfaction = st.number_input("Relationship Satisfaction") StandardHours = st.number_input("Standard Hours") StockOptionLevel = st.number_input("Stock Option Level") TotalWorkingYears = st.number_input("Total Working Years") TrainingTimesLastYear = st.number_input("Training Times Last Year") WorkLifeBalance = st.number_input("Work Life Balance") YearsAtCompany = st.number_input("Years At Company") YearsInCurrentRole = st.number_input("Years In Current Role") YearsSinceLastPromotion = st.number_input("Years Since Last Promotion") YearsWithCurrManager = st.number_input("Years With Current Manager") # Create a feature list from the user inputs features = [[Age,BusinessTravel,DailyRate,Department,DistanceFromHome,Education,EducationField,EmployeeCount,EmployeeNumber,EnvironmentSatisfaction,Gender,HourlyRate,JobInvolvement,JobLevel,JobRole,JobSatisfaction,MaritalStatus,MonthlyIncome,MonthlyRate,NumCompaniesWorked,Over18,OverTime,PercentSalaryHike,PerformanceRating,RelationshipSatisfaction,StandardHours,StockOptionLevel,TotalWorkingYears,TrainingTimesLastYear,WorkLifeBalance,YearsAtCompany,YearsInCurrentRole,YearsSinceLastPromotion,YearsWithCurrManager]] # Load the model model = load_model() # Make a prediction when the user clicks the "Predict" button if st.button('Predict Attrition'): predicted_value = model_prediction(model, features) if predicted_value == 0: st.success(f"The Employee will leave the company") else: st.success(f"The Employee will not leave the company") def about_hidevs(): components.html("""

🚀 Unlock Your Dream Job with HiDevs Community!

🔍 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.

đź’Ľ We offer an upskill program in Gen AI, Data Science, Machine Learning, and assist startups in adopting Gen AI at minimal development costs.

🆓 Best of all, everything we offer is completely free! We are dedicated to helping society.

Book free of cost 1:1 mentorship on any topic of your choice — topmate

✨ 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 here

đź’ˇ Join us now, and turbocharge your career!

Website YouTube Instagram Medium LinkedIn GitHub

""", height=600) def main(): # Set the app title and add your website name and logo st.set_page_config( page_title="Employee Attrition Prediction", page_icon=":chart_with_upwards_trend:", ) st.title("Welcome to our Employee Attrition Prediction App!") app_design() st.header("About HiDevs Community") about_hidevs() if __name__ == '__main__': main()