File size: 1,935 Bytes
62c442e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from ssl import Options
import joblib
import pandas as pd
import streamlit as st


model = joblib.load('model.joblib')
unique_values = joblib.load('unique_values(1).joblib')
    

#unique_post_on =  unique_values["Posted On"]
unique_fea_1 = unique_values["fea_1"]
unique_fea_2 = unique_values["fea_2"]
unique_fea_3 = unique_values["fea_3"]
unique_fea_4 = unique_values["fea_4"]
unique_fea_5 = unique_values["fea_5"]
unique_fea_6 = unique_values["fea_6"]
unique_fea_7 = unique_values["fea_7"]
unique_fea_8 = unique_values["fea_8"]
unique_fea_9 = unique_values["fea_9"]
unique_fea_10 = unique_values["fea_10"]
unique_fea_11 = unique_values["fea_11"]


def main():
    st.title("Customer check risk")

    with st.form("questionaire"):
        fea1 = st.selectbox(options =unique_fea_1 )
        fea3 = st.selectbox(options =unique_fea_3)
        fea5 = st.selectbox(options =unique_fea_5 )
        fea6 = st.selectbox(options =unique_fea_6 )
        fea7 = st.selectbox(options =unique_fea_7 )
        fea9 = st.selectbox(options =unique_fea_9 )

        # clicked==True only when the button is clicked
        clicked = st.form_submit_button("risk")
        if clicked:
            result=model.predict(pd.DataFrame({"fea1": [fea1],
                                               "fea3": [fea3],                                               
                                               "fea5": [fea5],
                                               "fea6": [fea6],
                                               "fea7": [fea7],
                                               "fea9": [fea9]
                                               }))
            # Show prediction
            if result==1:
                result='the customer is in high credit risk'
            else :
                result='the customer is in low credit risk'
            st.success('Your risk is '+result)
# Run main()
if __name__=='__main__':
    main()