avc3px commited on
Commit
be2522c
·
verified ·
1 Parent(s): 34a142b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -15,13 +15,13 @@ 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(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,
24
- 'PhysHealth':PhysHealth, 'DiffWalk':DiffWalk, 'Sex':Sex, 'Age':Age, 'Education':Education, 'Income':Income},
25
  orient = 'index').transpose()
26
 
27
  prob = loaded_model.predict_proba(new_row)
@@ -83,7 +83,7 @@ with gr.Blocks(title=title) as demo:
83
 
84
  submit_btn.click(
85
  main_func,
86
- [HighBP, HighChol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump, AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHealth, DiffWalk, Sex, Age, Education, Income],
87
  [label,local_plot], api_name="Diabetes_Predictor"
88
  )
89
 
 
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, PhysHlth, 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,
24
+ 'PhysHlth':PhysHealth, 'DiffWalk':DiffWalk, 'Sex':Sex, 'Age':Age, 'Education':Education, 'Income':Income},
25
  orient = 'index').transpose()
26
 
27
  prob = loaded_model.predict_proba(new_row)
 
83
 
84
  submit_btn.click(
85
  main_func,
86
+ [HighBP, HighChol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAttack, PhysActivity, Fruits, Veggies, HvyAlcoholConsump, AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHlth, DiffWalk, Sex, Age, Education, Income],
87
  [label,local_plot], api_name="Diabetes_Predictor"
88
  )
89