Upload app.py
Browse files
app.py
CHANGED
@@ -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 (1).joblib')
|
8 |
+
unique_values = joblib.load('unique_values (2).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.slider(min_value = 2, max_value=7 )
|
30 |
+
fea3 = st.slider(min_value = 1, max_value=2 )
|
31 |
+
fea5 = st.selectbox(options =unique_fea_5 )
|
32 |
+
fea6 = st.slider(min_value=3, max_value = 15 )
|
33 |
+
fea7 = st.slider(min_value=-1, max_value =10 )
|
34 |
+
fea9 = st.selectbox(options =unique_fea_9 )
|
35 |
+
|
36 |
+
# clicked==True only when the button is clicked
|
37 |
+
clicked = st.form_submit_button("credit 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()
|