Mummia-99 commited on
Commit
e71ba74
·
verified ·
1 Parent(s): 5156962

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +93 -82
app.py CHANGED
@@ -1,83 +1,94 @@
1
- import streamlit as st
2
- import joblib
3
- import numpy as np
4
- html_temp = """
5
- <div style="background-color:black;padding:10px">
6
- <h2 style="color:white;text-align:center;">Banking Churn Model App </h2>
7
- </div>
8
- """
9
- st.markdown(html_temp, unsafe_allow_html=True)
10
-
11
- st.write("Enter the customer details:")
12
-
13
- # model
14
-
15
- bank_model=joblib.load("bank_churn_svc_model.joblib")
16
-
17
- # Input variables
18
-
19
- col1, col2 = st.columns(2)
20
- with col1:
21
- ## CreditScore
22
- credit_score=st.slider("Slide the Credit Score Value:",min_value=350,max_value=850)
23
-
24
- with col2:
25
- ## Geography
26
- option_geo=["France","Spain","Germany"]
27
- geo=st.selectbox("Select The Geography: ",options=option_geo)
28
- geography_value=option_geo.index(geo)
29
-
30
- col1, col2 = st.columns(2)
31
- with col1:
32
- ## gender
33
- option_gen=["Female "," Male"]
34
- gen=st.selectbox("Select the Gender",option_gen)
35
- gender_value=option_gen.index(gen)
36
- with col2:
37
- ## Age
38
- age=st.number_input("Enter your AGE:",max_value=92,min_value=18)
39
-
40
- col1,col2=st.columns(2)
41
- with col1:
42
- ## Tenure
43
- tenure=st.slider("Slide the Tenure of the Loan:",min_value=0,max_value=10)
44
-
45
- with col2:
46
- ## Balance
47
- balance=st.slider("Slide The Balance Of the your Account:",min_value=0.0,max_value=250898.09)
48
-
49
- col1,col2=st.columns(2)
50
-
51
- with col1:
52
- ## IsActiveMember
53
- active_holder= st.radio("Are you Active Account Holder:", ["YES", "NO"])
54
- if active_holder=="YES":
55
- active_holder_value=1
56
- else:
57
- active_holder_value=0
58
-
59
- with col2:
60
- ## EstimatedSalary
61
- e_salary=st.slider("Silde the Salary :",max_value=199992,min_value=11)
62
-
63
-
64
-
65
- if st.button("Submit"):
66
-
67
- # Scaler the values
68
-
69
- credit_score=np.round(((credit_score-650.528800)/96.653299),3)
70
- age=np.round(((age-38.921800)/10.487806),3)
71
- tenure=np.round(((tenure-5.012800)/2.8921740),3)
72
- balance=np.round(((balance-76485.889288)/62397.405202),3)
73
- e_salary=np.round(((e_salary-100090.239881)/57510.492818),3)
74
-
75
-
76
- output = bank_model.predict([[credit_score, geography_value, gender_value, age, tenure, balance, e_salary, active_holder_value]])
77
-
78
-
79
- if output ==0:
80
- st.write("The Customer is Interseted in our Bank")
81
- else:
82
- st.write("The Customer is Not Interseted in our Bank")
 
 
 
 
 
 
 
 
 
 
 
83
 
 
1
+ import streamlit as st
2
+ import joblib
3
+ import numpy as np
4
+ html_temp = """
5
+ <div style="background-color:black;padding:10px">
6
+ <h2 style="color:white;text-align:center;">Banking Churn Model App </h2>
7
+ </div>
8
+ """
9
+ st.markdown(html_temp, unsafe_allow_html=True)
10
+ st.markdown(f"""
11
+ <style>
12
+ /* Set the background image for the entire app */
13
+ .stApp {{
14
+ background-color#abf62d;
15
+ background-size: 100px;
16
+ background-repeat:no;
17
+ background-attachment: auto;
18
+ background-position:full;
19
+ }}
20
+ </style>
21
+ """, unsafe_allow_html=True)
22
+ st.write("Enter the customer details:")
23
+
24
+ # model
25
+
26
+ bank_model=joblib.load("bank_churn_svc_model.joblib")
27
+
28
+ # Input variables
29
+
30
+ col1, col2 = st.columns(2)
31
+ with col1:
32
+ ## CreditScore
33
+ credit_score=st.slider("Slide the Credit Score Value:",min_value=350,max_value=850)
34
+
35
+ with col2:
36
+ ## Geography
37
+ option_geo=["France","Spain","Germany"]
38
+ geo=st.selectbox("Select The Geography: ",options=option_geo)
39
+ geography_value=option_geo.index(geo)
40
+
41
+ col1, col2 = st.columns(2)
42
+ with col1:
43
+ ## gender
44
+ option_gen=["Female "," Male"]
45
+ gen=st.selectbox("Select the Gender",option_gen)
46
+ gender_value=option_gen.index(gen)
47
+ with col2:
48
+ ## Age
49
+ age=st.number_input("Enter your AGE:",max_value=92,min_value=18)
50
+
51
+ col1,col2=st.columns(2)
52
+ with col1:
53
+ ## Tenure
54
+ tenure=st.slider("Slide the Tenure of the Loan:",min_value=0,max_value=10)
55
+
56
+ with col2:
57
+ ## Balance
58
+ balance=st.slider("Slide The Balance Of the your Account:",min_value=0.0,max_value=250898.09)
59
+
60
+ col1,col2=st.columns(2)
61
+
62
+ with col1:
63
+ ## IsActiveMember
64
+ active_holder= st.radio("Are you Active Account Holder:", ["YES", "NO"])
65
+ if active_holder=="YES":
66
+ active_holder_value=1
67
+ else:
68
+ active_holder_value=0
69
+
70
+ with col2:
71
+ ## EstimatedSalary
72
+ e_salary=st.slider("Silde the Salary :",max_value=199992,min_value=11)
73
+
74
+
75
+
76
+ if st.button("Submit"):
77
+
78
+ # Scaler the values
79
+
80
+ credit_score=np.round(((credit_score-650.528800)/96.653299),3)
81
+ age=np.round(((age-38.921800)/10.487806),3)
82
+ tenure=np.round(((tenure-5.012800)/2.8921740),3)
83
+ balance=np.round(((balance-76485.889288)/62397.405202),3)
84
+ e_salary=np.round(((e_salary-100090.239881)/57510.492818),3)
85
+
86
+
87
+ output = bank_model.predict([[credit_score, geography_value, gender_value, age, tenure, balance, e_salary, active_holder_value]])
88
+
89
+
90
+ if output ==0:
91
+ st.write("The Customer is Interseted in our Bank")
92
+ else:
93
+ st.write("The Customer is Not Interseted in our Bank")
94