Beladiaamy commited on
Commit
73c527b
·
verified ·
1 Parent(s): 86508a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -31
app.py CHANGED
@@ -45,39 +45,60 @@ with gr.Blocks(title=title) as demo:
45
  gr.Markdown(description2)
46
  gr.Markdown("""---""")
47
 
48
- input_block_left = gr.Column(
49
- HighBP = gr.Radio(label="Do you have high Blood Pressure?", choices=["No", "Yes"], default="Yes", description="0 = no high BP, 1 = high BP"),
50
- HighChol = gr.Radio(label="Do you have high Cholesterol?", choices=["No", "Yes"], default="Yes", description="0 = no high cholesterol, 1 = high cholesterol"),
51
- CholCheck = gr.Radio(label="Did you have a Cholesterol check in past 5 years?", choices=["No", "Yes"], default="Yes", description="No = not checked in 5 years, Yes = checked in 5 years"),
52
- BMI = gr.Number(label="BMI", minimum=0, maximum=98, default=1),
53
- Smoker = gr.Radio(label="Are you a smoker?", choices=["No", "Yes"], default="Yes", description="No = never smoked, Yes = smoked at least 100 cigarettes"),
54
- Stroke = gr.Radio(label="Have you had a stroke?", choices=["No", "Yes"], default="Yes", description="No = never had a stroke, Yes = had a stroke"),
55
- HeartDiseaseorAttack = gr.Radio(label="Do you have coronary heart disease or myocardial infarction?", choices=["No", "Yes"], default="Yes", description="No = no CHD/MI, Yes = CHD/MI"),
56
- PhysActivity = gr.Radio(label="Physical Activity in the past 30 days?", choices=["No", "Yes"], default="Yes", description="No = no activity, Yes = active"),
57
- Fruits = gr.Radio(label="Do you consume fruit 1 or more times per day?", choices=["No", "Yes"], default="Yes", description="No = less than daily, Yes = daily"),
58
- Veggies = gr.Radio(label="Do you consume Vegetables 1 or more times per day?", choices=["No", "Yes"], default="Yes", description="No = less than daily, Yes = daily"),
59
- HvyAlcoholConsump = gr.Radio(label="Do you drink often? (adult men having more than 14 drinks/week and adult women having more than 7 drinks/week)", choices=["No", "Yes"], default="Yes", description="No = not heavy drinker, Yes = heavy drinker"),
60
- AnyHealthcare = gr.Radio(label="Do you have any kind of health care coverage? (e.g., health insurance, prepaid plans such as HMO)", choices=["No", "Yes"], default="Yes", description="No = no coverage, Yes = coverage"),
61
- NoDocbcCost = gr.Radio(label="Was there a time in the past 12 months when you needed to see a doctor but could not because of cost?", choices=["No", "Yes"], default="Yes", description="No = no barrier, Yes = cost barrier")
62
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
- input_block_right = gr.Column(
65
- GenHlth = gr.Slider(label="In general, rank your health on a scale: 1(excellent)-5(poor)", minimum=1, maximum=5, default=1, step=1, description="1 = excellent, 5 = poor"),
66
- MentHlth = gr.Number(label="Poor Mental Health in the Past 30 Days", minimum=0, maximum=30, default=1, description="Days not good out of last 30"),
67
- PhysHlth = gr.Number(label="Poor Physical Health in the Past 30 Days", minimum=0, maximum=30, default=1, description="Days not good out of last 30"),
68
- DiffWalk = gr.Radio(label="Do you have serious difficulty walking or climbing stairs?", choices=["No", "Yes"], default="Yes", description="No = no difficulty, Yes = difficulty"),
69
- Sex = gr.Radio(label="Sex", choices=["Female", "Male"], default="Male", description="Female or Male"),
70
- Age = gr.Number(label="Age", minimum=1, maximum=100, default=1),
71
- Education = gr.Dropdown(label="Education Level", choices=["Never attended school", "Grades 1-8", "Grades 9-11", "Grade 12 or GED", "College 1-3 years", "College 4+ years"], default="Never attended school", description="Education level"),
 
 
 
 
 
 
 
72
  Income = gr.Dropdown(label="Income Level", choices=["< $10,000", "$10,000 - $24,999", "$25,000 - $49,999", "$50,000 - $74,999", "$75,000 or more"], default="< $10,000", description="Income level")
73
- )
74
-
75
- input_block = gr.Row([input_block_left, input_block_right])
76
-
77
- output_block = gr.Column(
78
- gr.Label(label="Predicted Label"),
79
- gr.Plot(label="SHAP Plot")
80
- )
81
 
82
  submit_btn = gr.Button("Analyze")
83
 
 
45
  gr.Markdown(description2)
46
  gr.Markdown("""---""")
47
 
48
+ with gr.Row():
49
+ with gr.Column():
50
+ HighBP = gr.Radio(label="Do you have high Blood Pressure?", choices=["No", "Yes"], default="Yes", description="0 = no high BP, 1 = high BP")
51
+ with gr.Column():
52
+ HighChol = gr.Radio(label="Do you have high Cholesterol?", choices=["No", "Yes"], default="Yes", description="0 = no high cholesterol, 1 = high cholesterol")
53
+ with gr.Row():
54
+ with gr.Column():
55
+ CholCheck = gr.Radio(label="Did you have a Cholesterol check in past 5 years?", choices=["No", "Yes"], default="Yes", description="No = not checked in 5 years, Yes = checked in 5 years")
56
+ with gr.Column()
57
+ BMI = gr.Number(label="BMI", minimum=0, maximum=98, default=1)
58
+ with gr.Row():
59
+ with gr.Column():
60
+ Smoker = gr.Radio(label="Are you a smoker?", choices=["No", "Yes"], default="Yes", description="No = never smoked, Yes = smoked at least 100 cigarettes")
61
+ with gr.Row():
62
+ with gr.Column():
63
+ Stroke = gr.Radio(label="Have you had a stroke?", choices=["No", "Yes"], default="Yes", description="No = never had a stroke, Yes = had a stroke")
64
+ with gr.Column():
65
+ HeartDiseaseorAttack = gr.Radio(label="Do you have coronary heart disease or myocardial infarction?", choices=["No", "Yes"], default="Yes", description="No = no CHD/MI, Yes = CHD/MI")
66
+ with gr.Row():
67
+ with gr.Column():
68
+ PhysActivity = gr.Radio(label="Physical Activity in the past 30 days?", choices=["No", "Yes"], default="Yes", description="No = no activity, Yes = active")
69
+ with gr.Row():
70
+ with gr.Column():
71
+ Fruits = gr.Radio(label="Do you consume fruit 1 or more times per day?", choices=["No", "Yes"], default="Yes", description="No = less than daily, Yes = daily")
72
+ with gr.Column():
73
+ Veggies = gr.Radio(label="Do you consume Vegetables 1 or more times per day?", choices=["No", "Yes"], default="Yes", description="No = less than daily, Yes = daily")
74
+ with gr.Column():
75
+ HvyAlcoholConsump = gr.Radio(label="Do you drink often? (adult men having more than 14 drinks/week and adult women having more than 7 drinks/week)", choices=["No", "Yes"], default="Yes", description="No = not heavy drinker, Yes = heavy drinker")
76
+ with gr.Row():
77
+ with gr.Column():
78
+ AnyHealthcare = gr.Radio(label="Do you have any kind of health care coverage? (e.g., health insurance, prepaid plans such as HMO)", choices=["No", "Yes"], default="Yes", description="No = no coverage, Yes = coverage")
79
+ with gr.Column():
80
+ NoDocbcCost = gr.Radio(label="Was there a time in the past 12 months when you needed to see a doctor but could not because of cost?", choices=["No", "Yes"], default="Yes", description="No = no barrier, Yes = cost barrier")
81
 
82
+ with gr.Row():
83
+ GenHlth = gr.Slider(label="In general, rank your health on a scale: 1(excellent)-5(poor)", minimum=1, maximum=5, default=1, step=1, description="1 = excellent, 5 = poor")
84
+ with gr.Row():
85
+ MentHlth = gr.Number(label="Poor Mental Health in the Past 30 Days", minimum=0, maximum=30, default=1, description="Days not good out of last 30")
86
+ with gr.Row():
87
+ PhysHlth = gr.Number(label="Poor Physical Health in the Past 30 Days", minimum=0, maximum=30, default=1, description="Days not good out of last 30")
88
+ with gr.Row():
89
+ DiffWalk = gr.Radio(label="Do you have serious difficulty walking or climbing stairs?", choices=["No", "Yes"], default="Yes", description="No = no difficulty, Yes = difficulty")
90
+ with gr.Row():
91
+ Sex = gr.Radio(label="Sex", choices=["Female", "Male"], default="Male", description="Female or Male")
92
+ with gr.Row():
93
+ Age = gr.Number(label="Age", minimum=1, maximum=100, default=1)
94
+ with gr.Row():
95
+ Education = gr.Dropdown(label="Education Level", choices=["Never attended school", "Grades 1-8", "Grades 9-11", "Grade 12 or GED", "College 1-3 years", "College 4+ years"], default="Never attended school", description="Education level")
96
+ with gr.Row():
97
  Income = gr.Dropdown(label="Income Level", choices=["< $10,000", "$10,000 - $24,999", "$25,000 - $49,999", "$50,000 - $74,999", "$75,000 or more"], default="< $10,000", description="Income level")
98
+
99
+ with gr.Column(visible=True) as output_col:
100
+ label = gr.Label(label = "Predicted Label")
101
+ local_plot = gr.Plot(label = 'Shap:')
 
 
 
 
102
 
103
  submit_btn = gr.Button("Analyze")
104