Yashvj123 commited on
Commit
28e33ca
·
verified ·
1 Parent(s): 30e88fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -2,10 +2,9 @@ import streamlit as st
2
  import numpy as np
3
  import pickle
4
 
5
- # Load trained model
6
  model = pickle.load(open("life_expectancy_model.pkl", "rb"))
7
 
8
- # Apply CSS for Better UI
9
  st.markdown("""
10
  <style>
11
  .title-container {
@@ -35,11 +34,9 @@ st.markdown("""
35
  </style>
36
  """, unsafe_allow_html=True)
37
 
38
- # Attractive Title
39
  st.markdown("<h1 class='title-container'>Life Expectancy Prediction</h1>", unsafe_allow_html=True)
40
  st.markdown("### Enter the required details in the sidebar to get the predicted life expectancy.")
41
 
42
- # Sidebar Inputs
43
  st.sidebar.markdown("<h2 class='sidebar-title'>Input Features</h2>", unsafe_allow_html=True)
44
 
45
  year = st.sidebar.slider("Year", 2000, 2015, 2008)
@@ -64,7 +61,6 @@ thinness_5_9 = st.sidebar.slider("Thinness 5-9 years (%)", 0.1, 28.6, 4.86)
64
  income_composition = st.sidebar.slider("Income Composition of Resources", 0.0, 0.948, 0.63)
65
  schooling = st.sidebar.slider("Schooling (Years)", 0.0, 20.7, 11.99)
66
 
67
- # Predict Button
68
  if st.button("Predict Life Expectancy"):
69
  features = np.array([[year, status, adult_mortality, infant_deaths, alcohol, percentage_expenditure,
70
  hepatitis_b, measles, bmi, under_five_deaths, polio, total_expenditure,
@@ -73,6 +69,5 @@ if st.button("Predict Life Expectancy"):
73
 
74
  prediction = model.predict(features)[0]
75
 
76
- # Display Result in a Stylish Box
77
  st.markdown(f'<div class="result-box">Predicted Life Expectancy: <b>{prediction:.2f} years</b></div>',
78
  unsafe_allow_html=True)
 
2
  import numpy as np
3
  import pickle
4
 
5
+
6
  model = pickle.load(open("life_expectancy_model.pkl", "rb"))
7
 
 
8
  st.markdown("""
9
  <style>
10
  .title-container {
 
34
  </style>
35
  """, unsafe_allow_html=True)
36
 
 
37
  st.markdown("<h1 class='title-container'>Life Expectancy Prediction</h1>", unsafe_allow_html=True)
38
  st.markdown("### Enter the required details in the sidebar to get the predicted life expectancy.")
39
 
 
40
  st.sidebar.markdown("<h2 class='sidebar-title'>Input Features</h2>", unsafe_allow_html=True)
41
 
42
  year = st.sidebar.slider("Year", 2000, 2015, 2008)
 
61
  income_composition = st.sidebar.slider("Income Composition of Resources", 0.0, 0.948, 0.63)
62
  schooling = st.sidebar.slider("Schooling (Years)", 0.0, 20.7, 11.99)
63
 
 
64
  if st.button("Predict Life Expectancy"):
65
  features = np.array([[year, status, adult_mortality, infant_deaths, alcohol, percentage_expenditure,
66
  hepatitis_b, measles, bmi, under_five_deaths, polio, total_expenditure,
 
69
 
70
  prediction = model.predict(features)[0]
71
 
 
72
  st.markdown(f'<div class="result-box">Predicted Life Expectancy: <b>{prediction:.2f} years</b></div>',
73
  unsafe_allow_html=True)