boringnose commited on
Commit
990b835
·
verified ·
1 Parent(s): 86207a1

Upload 5 files

Browse files

First App using Stramlit

Files changed (5) hide show
  1. app.py +42 -0
  2. insurance_joblib +0 -0
  3. logo.png +0 -0
  4. poly_obj +0 -0
  5. requiremnets.txt +3 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st #for frontend development
2
+ import joblib # import our model
3
+ # from PIL import Image #for images
4
+ import numpy as np
5
+
6
+ image="logo.png"
7
+ text = "### CodeWithGauravRajput bhai ka placement Prediction!!"
8
+ st.write(text)
9
+
10
+ # Display image in the first column
11
+ st.image(image, width=150)
12
+
13
+ # Display text in the second column
14
+ # with col2:
15
+
16
+ # creating UI
17
+ age = st.number_input("Age", min_value=10, max_value=90, value=30)
18
+ height = st.number_input("Height (in meters)", min_value=0.6, max_value=2.7, value=1.67)
19
+ weight = st.number_input("Weight (in Kg)", min_value=25, max_value=150, value=80)
20
+ children = st.number_input("Numbers of Children(s)", min_value=0, max_value=10, value=1)
21
+ smoker = st.selectbox("Smoke?", ("Yes", "No"))
22
+ sex = st.selectbox("Gender", ("Male", "Female", "CodeWithGauravRajput"))
23
+ if sex == "CodeWithGauravRajput":
24
+ st.write("End of LGBTQ debate")
25
+ if st.button("Get Quote"):
26
+ st.write("## Bhai Terko Premium ki nhi duaa ki jrurat h!!")
27
+ else:
28
+ # transforming data
29
+ bmi = weight/(height**2)
30
+ smoker_num = 0 if smoker == "No" else 1
31
+ test_data = [[age, bmi, children, smoker_num]]
32
+
33
+ # loading model
34
+ model = joblib.load("insurance_joblib")
35
+ poly = joblib.load("poly_obj")
36
+
37
+ if st.button("Get Quote"):
38
+ test_poly = poly.transform(test_data)
39
+ y_pred = model.predict(test_poly)
40
+ premium = np.exp(y_pred)[0]
41
+ # st.write("Kidney Bechni Pdegi")
42
+ st.write(f" #### Your premium is: ₹{round(premium,2)}")
insurance_joblib ADDED
Binary file (1.58 kB). View file
 
logo.png ADDED
poly_obj ADDED
Binary file (731 Bytes). View file
 
requiremnets.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit==1.32.2
2
+ numpy==1.26.3
3
+ joblib==1.3.2