dddddddd / app.py
Panupong's picture
Upload app.py
37b8f2c
from ssl import Options
import joblib
import pandas as pd
import streamlit as st
model = joblib.load('model (1).joblib')
unique_values = joblib.load('unique_values (2).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.slider(min_value = 2, max_value=7 )
fea3 = st.slider(min_value = 1, max_value=2 )
fea5 = st.selectbox(options =unique_fea_5 )
fea6 = st.slider(min_value=3, max_value = 15 )
fea7 = st.slider(min_value=-1, max_value =10 )
fea9 = st.selectbox(options =unique_fea_9 )
# clicked==True only when the button is clicked
clicked = st.form_submit_button("credit 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()