import streamlit as st
import joblib
# models
scaler=joblib.load('scaler_model.joblib')
insurance_model=joblib.load('insurance_fraud_model.joblib')
## Heading
html_temp = """
Insurance Claims Analysis
"""
st.markdown(html_temp, unsafe_allow_html=True)
## inputs
## 'incident_cause'
option_incident=['Driver error',"Crime","Other driver error",'Natural causes','Other causes']
incident_case=st.selectbox("Select the cause of incident :",options=option_incident)
incident_values=option_incident.index(incident_case)
## 'claim_area'
option_claim_area=["Auto","Home"]
claim_area=st.selectbox("Select the Claim Area: ",option_claim_area)
claim_area_value=option_claim_area.index(claim_area)
## 'police_report'
option_police_report=['NO',"Unknow","Yes"]
police_report=st.selectbox("You have Given Police Report:",option_police_report)
police_report_value=option_police_report.index(police_report)
## 'claim_type'
option_claim_type=["Material only ","Injury only","Material and injury"]
claim_type=st.selectbox("Select the Type of Claim :",option_claim_type)
claim_type_value=option_claim_type.index(claim_type)
## 'claim_amount'
claim_amount=st.slider("Slide the Claim Amount:",min_value=1000,max_value=48150)
## 'total_policy_claims'
policy_claims=st.slider("Slide the No of Policies Claimed:",min_value=0,max_value=8)
if st.button("Submit"):
# st.write(incident_values,claim_area_value,police_report_value,claim_area_value,claim_amount,policy_claims)
values=scaler.transform([[incident_values,claim_area_value,police_report_value,claim_area_value,claim_amount,policy_claims]])
#st.write(values)
output=insurance_model.predict(values)
if output==0:
st.write("The Transaction is Not Faurd")
else:
st.write("The Transaction is Faurd")