mavinsao commited on
Commit
84bcaaf
1 Parent(s): c9b5b01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -29,13 +29,10 @@ if st.button("Explain"):
29
 
30
  # Save SHAP plot as HTML
31
  shap_html = shap.plots.text(shap_values, display=False)
32
-
33
- # Save the plot to an HTML file
34
- shap_html.save_html("shap_plot.html")
35
-
36
- # Read the HTML file and display in Streamlit
37
- with open("shap_plot.html", "r") as f:
38
- shap_html = f.read()
39
 
 
 
 
 
40
  # Display the SHAP plot in Streamlit using components
41
- st.components.v1.html(shap_html, height=500, scrolling=True)
 
29
 
30
  # Save SHAP plot as HTML
31
  shap_html = shap.plots.text(shap_values, display=False)
 
 
 
 
 
 
 
32
 
33
+ # Save the plot to an HTML file
34
+ with open("shap_plot.html", "w") as f:
35
+ f.write(shap_html)
36
+
37
  # Display the SHAP plot in Streamlit using components
38
+ st.components.v1.html(shap_html, height=500, scrolling=True)