Update app.py
Browse files
app.py
CHANGED
@@ -27,11 +27,19 @@ def main_func(HighBP, HighChol, CholCheck, BMI, Smoker, Stroke, HeartDiseaseorAt
|
|
27 |
plt.tight_layout()
|
28 |
local_plot = plt.gcf()
|
29 |
plt.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
# Return the predicted label along with the SHAP plots
|
32 |
-
return {"Predicted Label": "Low Chance" if prob[0][0] < 0.5 else "High Chance",
|
33 |
-
|
34 |
-
|
35 |
|
36 |
|
37 |
#return {"Low Chance": float(prob[0][0]), "High Chance": 1-float(prob[0][0])}
|
|
|
27 |
plt.tight_layout()
|
28 |
local_plot = plt.gcf()
|
29 |
plt.close()
|
30 |
+
|
31 |
+
# Save the SHAP plot as an image
|
32 |
+
plot.savefig("/home/user/app/gradio_cached_examples/shap_plot.png")
|
33 |
+
|
34 |
+
# Return the predicted label along with the path to the saved SHAP plot
|
35 |
+
return {"Predicted Label": "Low Chance" if prob[0][0] < 0.5 else "High Chance",
|
36 |
+
"SHAP Plot": "/home/user/app/gradio_cached_examples/shap_plot.png"}
|
37 |
+
|
38 |
|
39 |
# Return the predicted label along with the SHAP plots
|
40 |
+
#return {"Predicted Label": "Low Chance" if prob[0][0] < 0.5 else "High Chance",
|
41 |
+
# "SHAP Summary Plot": "/home/user/app/gradio_cached_examples/shap_summary_plot.png",
|
42 |
+
# "SHAP Summary Plot (without bar)": "/home/user/app/gradio_cached_examples/shap_summary_plot_no_bar.png"}
|
43 |
|
44 |
|
45 |
#return {"Low Chance": float(prob[0][0]), "High Chance": 1-float(prob[0][0])}
|