Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,32 +39,36 @@ elif page == "π Predict":
|
|
| 39 |
st.sidebar.header("π Enter Your Health Details")
|
| 40 |
|
| 41 |
# Demographic Factors
|
| 42 |
-
st.sidebar.
|
| 43 |
-
age = st.sidebar.number_input("
|
| 44 |
-
education = st.sidebar.selectbox("
|
| 45 |
-
sex = st.sidebar.radio("
|
| 46 |
|
| 47 |
# Lifestyle Factors
|
| 48 |
-
st.sidebar.
|
| 49 |
-
is_smoking = st.sidebar.radio("
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
# Medical History
|
| 53 |
-
st.sidebar.
|
| 54 |
-
bp_meds = st.sidebar.radio("
|
| 55 |
-
prevalent_stroke = st.sidebar.radio("
|
| 56 |
-
prevalent_hyp = st.sidebar.radio("
|
| 57 |
-
diabetes = st.sidebar.radio("
|
| 58 |
|
| 59 |
# Health Measurements
|
| 60 |
-
st.sidebar.
|
| 61 |
-
total_cholesterol = st.sidebar.number_input("
|
| 62 |
-
systolic_bp = st.sidebar.slider("
|
| 63 |
-
diastolic_bp = st.sidebar.slider("
|
| 64 |
-
bmi = st.sidebar.number_input("
|
| 65 |
-
heart_rate = st.sidebar.slider("
|
| 66 |
-
glucose = st.sidebar.number_input("
|
| 67 |
|
|
|
|
| 68 |
if st.sidebar.button("π Predict Heart Risk"):
|
| 69 |
prediction = model.predict([[age, education, sex, is_smoking, cigs_per_day, bp_meds, prevalent_stroke,
|
| 70 |
prevalent_hyp, diabetes, total_cholesterol, systolic_bp, diastolic_bp,
|
|
|
|
| 39 |
st.sidebar.header("π Enter Your Health Details")
|
| 40 |
|
| 41 |
# Demographic Factors
|
| 42 |
+
st.sidebar.markdown("<h3 style='color:blue;'>π€ Demographic Factors</h3>", unsafe_allow_html=True)
|
| 43 |
+
age = st.sidebar.number_input("Age", 1, 120, 30)
|
| 44 |
+
education = st.sidebar.selectbox("Education Level", [1, 2, 3, 4])
|
| 45 |
+
sex = st.sidebar.radio("Sex", ["Male", "Female"], horizontal=True)
|
| 46 |
|
| 47 |
# Lifestyle Factors
|
| 48 |
+
st.sidebar.markdown("<h3 style='color:green;'>π¬ Lifestyle Factors</h3>", unsafe_allow_html=True)
|
| 49 |
+
is_smoking = st.sidebar.radio("Do you smoke?", ["Yes", "No"], horizontal=True)
|
| 50 |
+
if is_smoking == "Yes":
|
| 51 |
+
cigs_per_day = st.sidebar.slider("Cigarettes Per Day", 0, 100, 0)
|
| 52 |
+
else:
|
| 53 |
+
cigs_per_day = 0
|
| 54 |
|
| 55 |
# Medical History
|
| 56 |
+
st.sidebar.markdown("<h3 style='color:purple;'>π©Ί Medical History</h3>", unsafe_allow_html=True)
|
| 57 |
+
bp_meds = st.sidebar.radio("Blood Pressure Medication", ["Yes", "No"], horizontal=True)
|
| 58 |
+
prevalent_stroke = st.sidebar.radio("Had a stroke?", ["Yes", "No"], horizontal=True)
|
| 59 |
+
prevalent_hyp = st.sidebar.radio("Hypertension?", ["Yes", "No"], horizontal=True)
|
| 60 |
+
diabetes = st.sidebar.radio("Diabetes?", ["Yes", "No"], horizontal=True)
|
| 61 |
|
| 62 |
# Health Measurements
|
| 63 |
+
st.sidebar.markdown("<h3 style='color:red;'>π Health Measurements</h3>", unsafe_allow_html=True)
|
| 64 |
+
total_cholesterol = st.sidebar.number_input("Total Cholesterol (mg/dL) (125-200 Normal)", 100.0, 400.0, 200.0)
|
| 65 |
+
systolic_bp = st.sidebar.slider("Systolic BP (mmHg) (90-120 Normal)", 50.0, 250.0, 120.0)
|
| 66 |
+
diastolic_bp = st.sidebar.slider("Diastolic BP (mmHg) (60-80 Normal)", 30.0, 150.0, 80.0)
|
| 67 |
+
bmi = st.sidebar.number_input("BMI (18.5-24.9 Normal)", 10.0, 50.0, 25.0)
|
| 68 |
+
heart_rate = st.sidebar.slider("Heart Rate (bpm) (60-100 Normal)", 30.0, 200.0, 70.0)
|
| 69 |
+
glucose = st.sidebar.number_input("Glucose (mg/dL) (70-140 Normal)", 50.0, 300.0, 90.0)
|
| 70 |
|
| 71 |
+
|
| 72 |
if st.sidebar.button("π Predict Heart Risk"):
|
| 73 |
prediction = model.predict([[age, education, sex, is_smoking, cigs_per_day, bp_meds, prevalent_stroke,
|
| 74 |
prevalent_hyp, diabetes, total_cholesterol, systolic_bp, diastolic_bp,
|