Harika22 commited on
Commit
a2240a2
Β·
verified Β·
1 Parent(s): 36694f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -19
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.subheader("πŸ‘€ Demographic Factors")
43
- age = st.sidebar.number_input("πŸ“… Age", 1, 120, 30, help="Enter your age in years.")
44
- education = st.sidebar.selectbox("πŸŽ“ Education Level", ["Primary (1)", "Secondary (2)", "Higher Education (3)", "Postgraduate (4)"], help="Select your highest education level.")
45
- sex = st.sidebar.radio("⚀ Sex", ["Male", "Female"], horizontal=True, help="Select your biological sex.")
46
 
47
  # Lifestyle Factors
48
- st.sidebar.subheader("🚬 Lifestyle Factors")
49
- is_smoking = st.sidebar.radio("🚭 Do you smoke?", ["Yes", "No"], horizontal=True, help="Indicate if you are a smoker.")
50
- cigs_per_day = st.sidebar.slider("🚬 Cigarettes Per Day", 0, 100, 0, help="If you smoke, enter the number of cigarettes you consume daily.") if is_smoking == "Yes" else 0
 
 
 
51
 
52
  # Medical History
53
- st.sidebar.subheader("🩺 Medical History")
54
- bp_meds = st.sidebar.radio("πŸ’Š Blood Pressure Medication", ["Yes", "No"], horizontal=True, help="Are you taking medication for blood pressure?")
55
- prevalent_stroke = st.sidebar.radio("⚠️ Had a Stroke?", ["Yes", "No"], horizontal=True, help="Have you ever experienced a stroke?")
56
- prevalent_hyp = st.sidebar.radio("🩸 Hypertension?", ["Yes", "No"], horizontal=True, help="Do you have high blood pressure?")
57
- diabetes = st.sidebar.radio("🩸 Diabetes?", ["Yes", "No"], horizontal=True, help="Have you been diagnosed with diabetes?")
58
 
59
  # Health Measurements
60
- st.sidebar.subheader("πŸ“Š Health Measurements")
61
- total_cholesterol = st.sidebar.number_input("🩸 Total Cholesterol (mg/dL)", 100.0, 400.0, 200.0, help="Healthy range: 125-200 mg/dL")
62
- systolic_bp = st.sidebar.slider("πŸ“Œ Systolic BP (mmHg)", 50.0, 250.0, 120.0, help="Healthy range: 90-120 mmHg")
63
- diastolic_bp = st.sidebar.slider("πŸ’¬ Diastolic BP (mmHg)", 30.0, 150.0, 80.0, help="Healthy range: 60-80 mmHg")
64
- bmi = st.sidebar.number_input("βš–οΈ BMI", 10.0, 50.0, 25.0, help="Healthy range: 18.5-24.9")
65
- heart_rate = st.sidebar.slider("πŸ«€ Heart Rate (bpm)", 30.0, 200.0, 70.0, help="Healthy range: 60-100 bpm")
66
- glucose = st.sidebar.number_input("🩸 Glucose (mg/dL)", 50.0, 300.0, 90.0, help="Healthy range: 70-140 mg/dL")
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,