Update app.py
Browse files
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(
|
| 19 |
-
new_row = pd.DataFrame.from_dict({
|
| 20 |
-
'HighBP':HighBP,'
|
| 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 |
-
[
|
| 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]], [
|
| 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()
|