Beladiaamy commited on
Commit
a1b617f
·
verified ·
1 Parent(s): b825e19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -14
app.py CHANGED
@@ -71,22 +71,25 @@ def map_Sex(value):
71
 
72
  def map_Education(value):
73
  mapping = {
74
- "Never attended school": 0,
75
- "Grades 1-8": 1,
76
- "Grades 9-11": 2,
77
- "Grade 12 or GED": 3,
78
- "College 1-3 years": 4,
79
- "College 4+ years": 5
80
  }
81
  return mapping[value]
82
 
83
  def map_Income(value):
84
  mapping = {
85
- "< $10,000": 0,
86
- "$10,000 - $24,999": 1,
87
- "$25,000 - $49,999": 2,
88
- "$50,000 - $74,999": 3,
89
- "$75,000 or more": 4
 
 
 
90
  }
91
  return mapping[value]
92
 
@@ -173,7 +176,7 @@ with gr.Blocks(title=title) as demo:
173
  Age = gr.Number(label="Age")
174
  with gr.Row():
175
  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"])
176
- 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"])
177
 
178
  with gr.Column(visible=True) as output_col:
179
  label = gr.Label(label = "Predicted Label")
@@ -191,8 +194,8 @@ with gr.Blocks(title=title) as demo:
191
  )
192
 
193
  gr.Markdown("### Click on any of the examples below to see how it works:")
194
- gr.Examples([["No", "No", "Yes", 22, "No", "No", "No", "Yes", "Yes", "Yes", "No", "No", "Yes", 3, 25, 23, "No", "Female", 22, "Grade 12 or GED", "$25,000 - $49,999"],
195
- ["Yes", "Yes", "Yes", 30, "Yes", "Yes", "Yes", "No", "No", "No", "Yes", "Yes", "No", 2, 20, 23, "No", "No", 21, "College 4+ years", "$75,000 or more"]],
196
  [HighBP, HighChol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump,
197
  AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHlth, DiffWalk, Sex, Age, Education, Income],
198
  [label,local_plot], main_func, cache_examples=True)
 
71
 
72
  def map_Education(value):
73
  mapping = {
74
+ "Never attended school": 1,
75
+ "Grades 1-8": 2,
76
+ "Grades 9-11": 3,
77
+ "Grade 12 or GED": 4,
78
+ "College 1-3 years": 5,
79
+ "College 4+ years": 6
80
  }
81
  return mapping[value]
82
 
83
  def map_Income(value):
84
  mapping = {
85
+ "> $10,000": 1,
86
+ "> $20,000": 2,
87
+ "> $25,000": 3,
88
+ "> $30,000": 4,
89
+ "> $35,000": 5,
90
+ "> $50,000": 6,
91
+ "> $60,000": 7
92
+ "< $75,000": 8
93
  }
94
  return mapping[value]
95
 
 
176
  Age = gr.Number(label="Age")
177
  with gr.Row():
178
  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"])
179
+ Income = gr.Dropdown(label="Income Level", choices=["> $10,000", "> $20,000", "> $25,000", "> $30,000", "> $35,000","> $50,000","> $60,000", "< $75,000"])
180
 
181
  with gr.Column(visible=True) as output_col:
182
  label = gr.Label(label = "Predicted Label")
 
194
  )
195
 
196
  gr.Markdown("### Click on any of the examples below to see how it works:")
197
+ gr.Examples([["No", "No", "Yes", 22, "No", "No", "No", "Yes", "Yes", "Yes", "No", "No", "Yes", 3, 25, 23, "No", "Female", 22, "Grade 12 or GED", "$35,000"],
198
+ ["Yes", "Yes", "Yes", 30, "Yes", "Yes", "Yes", "No", "No", "No", "Yes", "Yes", "No", 2, 20, 23, "No", "No", 21, "College 4+ years", "< $75,000"]],
199
  [HighBP, HighChol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump,
200
  AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHlth, DiffWalk, Sex, Age, Education, Income],
201
  [label,local_plot], main_func, cache_examples=True)