Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import numpy as np | |
| import joblib | |
| col1, col2 = st.columns([0.25,0.75], vertical_alignment = "center") | |
| with col1: | |
| st.image("./src/lic logo.png") | |
| with col2: | |
| st.title("Lic Insurance App") | |
| age = st.number_input(label = "Enter your Age", | |
| value = 30, min_value = 5, max_value = 70, | |
| step = 1) | |
| col3, col4 = st.columns([0.5,0.5], vertical_alignment = "center") | |
| with col3: | |
| feet = st.number_input(label = "Height in feet", | |
| value = 5, min_value = 0, max_value = 10, | |
| step = 1) | |
| with col4: | |
| inches = st.number_input(label = "Height in inches", | |
| value = 0, min_value = 0, max_value = 11, | |
| step = 1) | |
| weight = st.number_input(label = "Weight in kg", | |
| value = 50.0, min_value = 5.0, max_value = 200.0, | |
| step = 0.5) | |
| height_m = feet*0.3048 + inches*0.0254 | |
| bmi = weight / (height_m)**2 | |
| st.write(f"Your BMI is -: {round(bmi,2)}") | |
| children = st.slider(label = "Select number of Children", | |
| min_value=0, max_value=5, value=0, step=1) | |
| smoker = st.selectbox(label = "Enter Smoking Status", | |
| options = ("Yes", "No")) | |
| smoker_num = 1 if smoker == "Yes" else 0 | |
| test_data = [[age, bmi, children, smoker_num]] | |
| model = joblib.load("./src/model.joblib") | |
| std_scaler = joblib.load("./src/scaler.joblib") | |
| poly = joblib.load("./src/poly.joblib") | |
| if st.button("Get Premium") == True: | |
| test_scale = std_scaler.transform(test_data) | |
| test_poly = poly.transform(test_scale) | |
| y_pred_sqrt = model.predict(test_poly)[0] | |
| y_pred = round(y_pred_sqrt**2,2) | |
| st.header(f"Your Premium amount is ${y_pred}") | |