tby4rr commited on
Commit
adb7cab
·
verified ·
1 Parent(s): b0c6626

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -15,9 +15,9 @@ loaded_model = pickle.load(open("cdc_diabetes_health_indicators.pkl", 'rb'))
15
  explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
16
 
17
  # Create the main function for server
18
- def main_func(ID, Diabetes_binary, HighBP, HighCol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump, AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHealth, DiffWalk, Sex, Age, Education, Income):
19
- new_row = pd.DataFrame.from_dict({'ID':ID,'Diabetes_binary':Diabetes_binary,
20
- 'HighBP':HighBP,'HighCol':HighCol,'CholCheck':CholCheck,
21
  'BMI':BMI, 'Smoker':Smoker,'Stroke':Stroke,'HeartDiseaseorAttack':HeartDiseaseorAttack,
22
  'PhysActivity':PhysActivity,'Fruits':Fruits,'Veggies':Veggies,'HvyAlcoholConsump':HvyAlcoholConsump,
23
  'AnyHealthcare':AnyHealthcare, 'NoDocbcCost':NoDocbcCost, 'GenHlth':GenHlth, 'MenHlth': MenHlth,
@@ -76,11 +76,11 @@ with gr.Blocks(title=title) as demo:
76
 
77
  submit_btn.click(
78
  main_func,
79
- [ID, Diabetes_binary, HighBP, HighCol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump, AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHealth, DiffWalk, Sex, Age, Education, Income],
80
  [label,local_plot], api_name="Diabetes_Predictor"
81
  )
82
 
83
  gr.Markdown("### Click on any of the examples below to see how it works:")
84
- gr.Examples([[24,0,4,4,5,5,4,4,5,5,1,2,3], [24,0,4,4,5,3,3,2,1,1,1,2,3]], [ID, Diabetes_binary, HighBP, HighCol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump, AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHealth, DiffWalk, Sex, Age, Education, Income], [label,local_plot], main_func, cache_examples=True)
85
 
86
  demo.launch()
 
15
  explainer = shap.Explainer(loaded_model) # PLEASE DO NOT CHANGE THIS.
16
 
17
  # Create the main function for server
18
+ def main_func(HighBP, HighChol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump, AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHealth, DiffWalk, Sex, Age, Education, Income):
19
+ new_row = pd.DataFrame.from_dict({
20
+ 'HighBP':HighBP,'HighChol':HighChol,'CholCheck':CholCheck,
21
  'BMI':BMI, 'Smoker':Smoker,'Stroke':Stroke,'HeartDiseaseorAttack':HeartDiseaseorAttack,
22
  'PhysActivity':PhysActivity,'Fruits':Fruits,'Veggies':Veggies,'HvyAlcoholConsump':HvyAlcoholConsump,
23
  'AnyHealthcare':AnyHealthcare, 'NoDocbcCost':NoDocbcCost, 'GenHlth':GenHlth, 'MenHlth': MenHlth,
 
76
 
77
  submit_btn.click(
78
  main_func,
79
+ [HighBP, HighChol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump, AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHealth, DiffWalk, Sex, Age, Education, Income],
80
  [label,local_plot], api_name="Diabetes_Predictor"
81
  )
82
 
83
  gr.Markdown("### Click on any of the examples below to see how it works:")
84
+ gr.Examples([[24,0,4,4,5,5,4,4,5,5,1,2,3], [24,0,4,4,5,3,3,2,1,1,1,2,3]], [HighBP, HighChol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump, AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHealth, DiffWalk, Sex, Age, Education, Income], [label,local_plot], main_func, cache_examples=True)
85
 
86
  demo.launch()