pepperjirakit commited on
Commit
62c442e
1 Parent(s): a13e906

Upload app (1).py

Browse files
Files changed (1) hide show
  1. app (1).py +54 -0
app (1).py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ssl import Options
2
+ import joblib
3
+ import pandas as pd
4
+ import streamlit as st
5
+
6
+
7
+ model = joblib.load('model.joblib')
8
+ unique_values = joblib.load('unique_values(1).joblib')
9
+
10
+
11
+ #unique_post_on = unique_values["Posted On"]
12
+ unique_fea_1 = unique_values["fea_1"]
13
+ unique_fea_2 = unique_values["fea_2"]
14
+ unique_fea_3 = unique_values["fea_3"]
15
+ unique_fea_4 = unique_values["fea_4"]
16
+ unique_fea_5 = unique_values["fea_5"]
17
+ unique_fea_6 = unique_values["fea_6"]
18
+ unique_fea_7 = unique_values["fea_7"]
19
+ unique_fea_8 = unique_values["fea_8"]
20
+ unique_fea_9 = unique_values["fea_9"]
21
+ unique_fea_10 = unique_values["fea_10"]
22
+ unique_fea_11 = unique_values["fea_11"]
23
+
24
+
25
+ def main():
26
+ st.title("Customer check risk")
27
+
28
+ with st.form("questionaire"):
29
+ fea1 = st.selectbox(options =unique_fea_1 )
30
+ fea3 = st.selectbox(options =unique_fea_3)
31
+ fea5 = st.selectbox(options =unique_fea_5 )
32
+ fea6 = st.selectbox(options =unique_fea_6 )
33
+ fea7 = st.selectbox(options =unique_fea_7 )
34
+ fea9 = st.selectbox(options =unique_fea_9 )
35
+
36
+ # clicked==True only when the button is clicked
37
+ clicked = st.form_submit_button("risk")
38
+ if clicked:
39
+ result=model.predict(pd.DataFrame({"fea1": [fea1],
40
+ "fea3": [fea3],
41
+ "fea5": [fea5],
42
+ "fea6": [fea6],
43
+ "fea7": [fea7],
44
+ "fea9": [fea9]
45
+ }))
46
+ # Show prediction
47
+ if result==1:
48
+ result='the customer is in high credit risk'
49
+ else :
50
+ result='the customer is in low credit risk'
51
+ st.success('Your risk is '+result)
52
+ # Run main()
53
+ if __name__=='__main__':
54
+ main()