MVesalA commited on
Commit
40f117a
1 Parent(s): 43bcf99

Upload 2 files

Browse files
Files changed (2) hide show
  1. Churn_PredCls.joblib +3 -0
  2. app.py +48 -0
Churn_PredCls.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d940bc5d20ffc7a36a49b36263cb515bf9c6f57e49acf32d47f62656fb80dca1
3
+ size 13895
app.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import numpy as np
3
+ import pandas as pd
4
+ import joblib
5
+
6
+ model = joblib.load('Churn_Pred/Churn_PredCls.joblib')
7
+
8
+ gender = st.selectbox("Choose sex", ['Male', 'Female'])
9
+ SeniorCitizen = st.sidebar.selectbox("SeniorCitizen", ['Yes', 'No'])
10
+ Partner = st.sidebar.selectbox("Does he/she have partner?", ['Yes', 'No'])
11
+ Dependents = st.sidebar.selectbox("Dependents", ['Yes', 'No'])
12
+ tenure = st.slider("Choose tenure", 0, 100)
13
+ PhoneService = st.sidebar.selectbox("PhoneService", ['Yes', 'No'])
14
+ MultipleLines = st.sidebar.selectbox("MultipleLines", ['Yes', 'No'])
15
+ InternetService = st.selectbox("InternetService", ['DSL', 'Fiber optic', 'No'])
16
+ OnlineSecurity = st.sidebar.selectbox("OnlineSecurity", ['Yes', 'No'])
17
+ OnlineBackup = st.sidebar.selectbox("OnlineBackup", ['Yes', 'No'])
18
+ DeviceProtection = st.sidebar.selectbox("DeviceProtection", ['Yes', 'No'])
19
+ TechSupport = st.sidebar.selectbox("TechSupport", ['Yes', 'No'])
20
+ StreamingTV = st.sidebar.selectbox("StreamingTV", ['Yes', 'No'])
21
+ StreamingMovies = st.sidebar.selectbox("StreamingMovies", ['Yes', 'No'])
22
+ Contract = st.selectbox("Contract", ['Month-to-month', 'One year', 'Two year'])
23
+ PaperlessBilling = st.sidebar.selectbox("PaperlessBilling", ['Yes', 'No'])
24
+ PaymentMethod = st.selectbox("PaymentMethod", ['Electronic check', 'Mailed check', 'Bank transfer (automatic)', 'Credit card (automatic)'])
25
+ MonthlyCharges = st.slider("MonthlyCharges", 0, 1000)
26
+ TotalCharges = st.slider("TotalCharges", 0, 10000)
27
+
28
+ columns = ['gender', 'SeniorCitizen', 'Partner', 'Dependents', 'tenure',
29
+ 'PhoneService', 'MultipleLines', 'InternetService', 'OnlineSecurity',
30
+ 'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV',
31
+ 'StreamingMovies', 'Contract', 'PaperlessBilling', 'PaymentMethod',
32
+ 'MonthlyCharges', 'TotalCharges']
33
+
34
+ rows = [gender, SeniorCitizen, Partner, Dependents, tenure,
35
+ PhoneService, MultipleLines, InternetService, OnlineSecurity, OnlineBackup,
36
+ DeviceProtection, TechSupport, StreamingTV, StreamingMovies, Contract,
37
+ PaperlessBilling, PaymentMethod, MonthlyCharges, TotalCharges]
38
+
39
+ def predict():
40
+ row = np.array(rows)
41
+ X = pd.DataFrame([row], columns = columns)
42
+ prediction = model.predict(X)
43
+ if prediction[0] == 1:
44
+ st.success('She/He will remain among the customers :thumbsup:')
45
+ else:
46
+ st.error('She/He will not remain among the customers :thumbsup:')
47
+
48
+ trigger = st.button('Predict', on_click=predict)