Spaces:
Sleeping
Sleeping
| import streamlit as st #for frontend development | |
| import joblib # import our model | |
| # from PIL import Image #for images | |
| import numpy as np | |
| image="logo.png" | |
| text = "### CodeWithGauravRajput bhai ka placement Prediction!!" | |
| st.write(text) | |
| # Display image in the first column | |
| st.image(image, width=150) | |
| # Display text in the second column | |
| # with col2: | |
| # creating UI | |
| age = st.number_input("Age", min_value=10, max_value=90, value=30) | |
| height = st.number_input("Height (in meters)", min_value=0.6, max_value=2.7, value=1.67) | |
| weight = st.number_input("Weight (in Kg)", min_value=25, max_value=150, value=80) | |
| children = st.number_input("Numbers of Children(s)", min_value=0, max_value=10, value=1) | |
| smoker = st.selectbox("Smoke?", ("Yes", "No")) | |
| sex = st.selectbox("Gender", ("Male", "Female", "CodeWithGauravRajput")) | |
| if sex == "CodeWithGauravRajput": | |
| st.write("End of LGBTQ debate") | |
| if st.button("Get Quote"): | |
| st.write("## Bhai Terko Premium ki nhi duaa ki jrurat h!!") | |
| else: | |
| # transforming data | |
| bmi = weight/(height**2) | |
| smoker_num = 0 if smoker == "No" else 1 | |
| test_data = [[age, bmi, children, smoker_num]] | |
| # loading model | |
| model = joblib.load("insurance_joblib") | |
| poly = joblib.load("poly_obj") | |
| if st.button("Get Quote"): | |
| test_poly = poly.transform(test_data) | |
| y_pred = model.predict(test_poly) | |
| premium = np.exp(y_pred)[0] | |
| # st.write("Kidney Bechni Pdegi") | |
| st.write(f" #### Your premium is: ₹{round(premium,2)}") |