Gaurav069 commited on
Commit
ef1b888
·
verified ·
1 Parent(s): 6004847

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -0
app.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import joblib
3
+ import numpy as np
4
+ # from PIL import Image
5
+
6
+
7
+ st.image("logo.png",width = 150)
8
+ st.write("# Acko Health Insurance Predictor App")
9
+
10
+ Age = st.number_input("Enter your Age",min_value = 10,max_value = 90,value = 30,step = 1)
11
+ Height = st.number_input("Enter your Height in Meters",min_value = 0.6,max_value = 2.7,value = 1.67)
12
+ Weight = st.number_input("Enter your Weight in kilogram",min_value = 25,max_value = 200,value = 80)
13
+ BMI = Weight/Height**2
14
+ BodyMassIndex = st.write(f" Your BMI is {round(BMI,1)}")
15
+
16
+ Children = st.number_input("Enter No. of Children",min_value = 0,max_value = 10,value = 0,step = 1)
17
+
18
+ Sex = st.selectbox("Enter your Gender",("Male","Female"))
19
+
20
+ Smoker = st.selectbox("Do you Smoke?",("Yes","No"))
21
+ if Smoker == "Yes":
22
+ st.write("\u26A0 Smoking is injurious to health! \u26A0")
23
+
24
+
25
+ Smoker_num = 0 if Smoker == "No" else 1
26
+ test_data = [[Age,BMI,Children,Smoker_num]]
27
+
28
+ # Model Load
29
+ model = joblib.load("insurance_joblib")
30
+ poly = joblib.load("poly_obj")
31
+
32
+ if st.button("Get Quote"):
33
+
34
+ test_poly = poly.transform(test_data)
35
+ y_pred_log = model.predict(test_poly)
36
+ premium = round(np.exp(y_pred_log)[0],2)
37
+ st.write(f"## **Your Premium Amount is ${premium}**")