HR / app.py
namb0010's picture
Update app.py
c2ac57f
# -*- coding: utf-8 -*-
"""app
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1coUNcj1aXJN8fGu2dsf64GKHF5CoMNuJ
*`Uma Namboothiripad Final Project*
"""
import streamlit as st
import pandas as pd
import urllib
import pickle
st.title("Do your Employees Want to Leave You?")
st.markdown("Some of the factors below greatly impact if an employee with leave the organization")
"""Enter the employee's age"""
Age = st.number_input('Age:')
"""Please enter the numeric numbers for the following marital status of your employee. 0 = Divorced, 1= Married, 2= Single"""
MaritalStatus = st.number_input('Marital Status:')
"""Please enter the numeric numbers for the following job levels of your employee. 0 = Entry Level, 1= Intermediate, 2= Mid-Level, 3 = Assistant or Associate Director, 4 = Director"""
JobLevel=st.number_input('JobLevel:')
"""Enter the employee's monthly income from this job"""
MonthlyIncome = st.number_input('MonthlyIncome:')
"""Enter how many years the employee has worked full-time"""
TotalWorkingYears = st.number_input('TotalWorkingYears')
"""Enter how many years the employee has worked at this company"""
YearsAtCompany = st.number_input('YearsAtCompany')
"""Enter how many years the employee has last received a promotion"""
YearsSinceLastPromotion = st.number_input('YearsSinceLastPromotion')
"""Enter how many years the employee has worked for their current manager"""
YearsWithCurrManager = st.number_input('YearsWithCurrManager')
dataurl = 'https://colab.research.google.com/drive/1-8ctPDO-F1GYjztowygbfzJI2i5vZT9J?usp=sharing'
@st.cache(persist=True)
def load_data():
data_url = urllib.request.urlopen('https://colab.research.google.com/drive/1-8ctPDO-F1GYjztowygbfzJI2i5vZT9J?usp=sharing')
url="https://huggingface.co/datasets/namb0010/Turnover/raw/main/finalproject.csv"
df = pd.read_csv(url)
if st.button("Predict"):
picklefile = open("model.pkl", "rb")
model = pickle.load(picklefile)
X_test3 = [['Age', 'JobLevel', 'MaritalStatus', 'MonthlyIncome', 'TotalWorkingYears', 'YearsAtCompany', 'YearsSinceLastPromotion', 'YearsWithCurrManager']]
Y = model.predict(X_test3)
if Y== 0:
st.success('Congrats (or not) they will be sticking around longer')
elif Y == 1:
st.error( 'Plan the farewell party')