File size: 1,119 Bytes
9f1a491
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import numpy as np
import streamlit as st
import joblib

logo_url = "logo.png"
banner_path = "banner.jpg"

col1, col2= st.columns([1, 3])
with col1:
   st.image(logo_url, width = 100)
with col2:
   st.write("# Acko Insurance App")

st.image(banner_path)

age = st.number_input("Enter your age", step = 1)
height_ft = st.number_input("Enter feet part of your height", step = 1,value = 5)
height_inch = st.number_input("Enter inch part of your height", step = 1, value = 5)
weight_kg = st.number_input("Enter your weight in KG")
height_meter = height_ft *0.3048 + height_inch*0.0254
bmi = round(weight_kg/height_meter**2,2)
smoker = st.selectbox(
    "Enter your smoking status?",
    ("yes", "no"))
children = st.selectbox(
   "Enter Number of children",
   (0,1,2,3,4))

test_data = np.array([[age, bmi, smoker, children]])
st.write(test_data)

# load model
model = joblib.load("insurance_joblib")

# predict button
if st.button("Predict"):
   y_pred = model.predict(test_data)
   amount = np.round(y_pred**2,2)[0]
   st.write(f"## Your Insurance Premium amount is: ${amount}")