Update app.py
Browse files
app.py
CHANGED
|
@@ -216,10 +216,20 @@ elif st.session_state.current_page == "Simple EDA":
|
|
| 216 |
missing_values = data.isna().sum().reset_index()
|
| 217 |
missing_values.columns = ["Column Name", "Missing Values"]
|
| 218 |
|
| 219 |
-
st.
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
st.markdown("<br>", unsafe_allow_html=True)
|
| 222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
|
| 224 |
if st.button("π Go Back to Model Report"):
|
| 225 |
switch_page("Model Report")
|
|
@@ -274,103 +284,3 @@ elif st.session_state.current_page == "Hands-on Model":
|
|
| 274 |
|
| 275 |
if st.button("β¬
**Back to Model Report**"):
|
| 276 |
switch_page("Model Report")
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
# import streamlit as st
|
| 282 |
-
# import numpy as np
|
| 283 |
-
# import pickle
|
| 284 |
-
|
| 285 |
-
# model = pickle.load(open("life_expectancy_model.pkl", "rb"))
|
| 286 |
-
|
| 287 |
-
# st.set_page_config(
|
| 288 |
-
# page_title="Life Expectancy Prediction",
|
| 289 |
-
# page_icon="π",
|
| 290 |
-
# layout="centered",
|
| 291 |
-
# )
|
| 292 |
-
|
| 293 |
-
# st.markdown("""
|
| 294 |
-
# <style>
|
| 295 |
-
# .stApp {
|
| 296 |
-
# background-color: #E3F2FD; /* Soft blue background */
|
| 297 |
-
# }
|
| 298 |
-
# .title {
|
| 299 |
-
# text-align: center;
|
| 300 |
-
# font-size: 32px;
|
| 301 |
-
# font-weight: bold;
|
| 302 |
-
# color: #2C3E50;
|
| 303 |
-
# }
|
| 304 |
-
# .stButton > button {
|
| 305 |
-
# width: 100%;
|
| 306 |
-
# background-color: #1E88E5;
|
| 307 |
-
# color: white;
|
| 308 |
-
# font-size: 16px;
|
| 309 |
-
# border-radius: 6px;
|
| 310 |
-
# }
|
| 311 |
-
# .result-box {
|
| 312 |
-
# text-align: center;
|
| 313 |
-
# font-size: 22px;
|
| 314 |
-
# font-weight: bold;
|
| 315 |
-
# color: white;
|
| 316 |
-
# padding: 15px;
|
| 317 |
-
# border-radius: 8px;
|
| 318 |
-
# margin-top: 20px;
|
| 319 |
-
# background-color: #388E3C; /* Green */
|
| 320 |
-
# }
|
| 321 |
-
# .section-title {
|
| 322 |
-
# font-size: 20px;
|
| 323 |
-
# font-weight: bold;
|
| 324 |
-
# color: #1E88E5;
|
| 325 |
-
# margin-top: 20px;
|
| 326 |
-
# }
|
| 327 |
-
# </style>
|
| 328 |
-
# """, unsafe_allow_html=True)
|
| 329 |
-
|
| 330 |
-
# st.markdown("<h1 class='title'>Life Expectancy Prediction</h1>", unsafe_allow_html=True)
|
| 331 |
-
|
| 332 |
-
# col1, col2 = st.columns(2)
|
| 333 |
-
|
| 334 |
-
# with col1:
|
| 335 |
-
# year = st.slider("Year", 2000, 2015, 2008)
|
| 336 |
-
# status = st.radio("Status", ["Developing", "Developed"], horizontal=True)
|
| 337 |
-
# status = 1 if status == "Developed" else 0
|
| 338 |
-
# adult_mortality = st.slider("Adult Mortality Rate", 1, 723, 144)
|
| 339 |
-
# infant_deaths = st.slider("Infant Deaths", 0, 1800, 3)
|
| 340 |
-
# alcohol = st.slider("Alcohol Consumption", 0.01, 17.87, 4.55)
|
| 341 |
-
# percentage_expenditure = st.slider("Percentage Expenditure", 0.0, 19479.91, 738.25)
|
| 342 |
-
# hepatitis_b = st.slider("Hepatitis B Immunization (%)", 1, 99, 83)
|
| 343 |
-
# measles = st.slider("Measles Cases", 0, 212183, 2419)
|
| 344 |
-
# bmi = st.slider("BMI", 1.0, 87.3, 38.3)
|
| 345 |
-
# polio = st.slider("Polio Immunization (%)", 3, 99, 82)
|
| 346 |
-
|
| 347 |
-
# with col2:
|
| 348 |
-
# under_five_deaths = st.slider("Under-Five Deaths", 0, 2500, 4)
|
| 349 |
-
# total_expenditure = st.slider("Total Healthcare Expenditure (%)", 0.37, 17.6, 5.92)
|
| 350 |
-
# diphtheria = st.slider("Diphtheria Immunization (%)", 2, 99, 82)
|
| 351 |
-
# hiv_aids = st.slider("HIV/AIDS Prevalence Rate", 0.1, 50.6, 1.74)
|
| 352 |
-
# gdp = st.slider("GDP per Capita", 1.68, 119172.7, 6611.52)
|
| 353 |
-
# population = st.slider("Population", 34, 1293859000, 10230850)
|
| 354 |
-
# thinness_1_19 = st.slider("Thinness 1-19 years (%)", 0.1, 27.7, 4.83)
|
| 355 |
-
# thinness_5_9 = st.slider("Thinness 5-9 years (%)", 0.1, 28.6, 4.86)
|
| 356 |
-
# income_composition = st.slider("Income Composition of Resources", 0.0, 0.948, 0.63)
|
| 357 |
-
# schooling = st.slider("Schooling (Years)", 0.0, 20.7, 11.99)
|
| 358 |
-
|
| 359 |
-
# if st.button("Predict Life Expectancy"):
|
| 360 |
-
# features = np.array([[year, status, adult_mortality, infant_deaths, alcohol, percentage_expenditure,
|
| 361 |
-
# hepatitis_b, measles, bmi, under_five_deaths, polio, total_expenditure,
|
| 362 |
-
# diphtheria, hiv_aids, gdp, population, thinness_1_19, thinness_5_9,
|
| 363 |
-
# income_composition, schooling]])
|
| 364 |
-
|
| 365 |
-
# prediction = model.predict(features)[0]
|
| 366 |
-
|
| 367 |
-
# st.markdown(
|
| 368 |
-
# f"""
|
| 369 |
-
# <div class="result-box">
|
| 370 |
-
# Predicted Life Expectancy: <b>{prediction:.2f} years</b>
|
| 371 |
-
# </div>
|
| 372 |
-
# """,
|
| 373 |
-
# unsafe_allow_html=True,
|
| 374 |
-
# )
|
| 375 |
-
|
| 376 |
-
|
|
|
|
| 216 |
missing_values = data.isna().sum().reset_index()
|
| 217 |
missing_values.columns = ["Column Name", "Missing Values"]
|
| 218 |
|
| 219 |
+
col1, col2, col3 = st.columns([1, 2, 1])
|
| 220 |
+
|
| 221 |
+
with col2:
|
| 222 |
+
st.dataframe(missing_values)
|
| 223 |
|
| 224 |
st.markdown("<br>", unsafe_allow_html=True)
|
| 225 |
|
| 226 |
+
# Display missing values count
|
| 227 |
+
st.markdown("<h3 class='subtitle' style='text-align: center;'>Data Description</h3>", unsafe_allow_html=True)
|
| 228 |
+
|
| 229 |
+
st.dataframe(data.describe())
|
| 230 |
+
|
| 231 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 232 |
+
|
| 233 |
|
| 234 |
if st.button("π Go Back to Model Report"):
|
| 235 |
switch_page("Model Report")
|
|
|
|
| 284 |
|
| 285 |
if st.button("β¬
**Back to Model Report**"):
|
| 286 |
switch_page("Model Report")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|