Spaces:
Sleeping
Sleeping
Commit
·
25f7388
1
Parent(s):
cecdb11
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ subprocess.check_call(
|
|
| 7 |
[sys.executable, "-m", "pip", "install", package]
|
| 8 |
)
|
| 9 |
|
| 10 |
-
|
| 11 |
|
| 12 |
import numpy as np
|
| 13 |
import pandas as pd
|
|
@@ -29,8 +29,10 @@ st.caption("Linkedin: https://www.linkedin.com/in/allen-roush-27721011b/")
|
|
| 29 |
st.title("SHAP (SHapley Additive exPlanations)")
|
| 30 |
st.image("https://shap.readthedocs.io/en/latest/_images/shap_header.png", width = 700)
|
| 31 |
st.caption("By Lundberg, Scott M and Lee, Su-In")
|
|
|
|
| 32 |
st.caption("Full Citation: https://raw.githubusercontent.com/slundberg/shap/master/docs/references/shap_nips.bib")
|
| 33 |
st.caption("See on github:: https://github.com/slundberg/shap")
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
form = st.sidebar.form("Main Settings")
|
|
@@ -153,7 +155,6 @@ else:
|
|
| 153 |
shap_values = explainer([doc])
|
| 154 |
|
| 155 |
|
| 156 |
-
###REMEMBER YOU FIXED THE CODE IN SHAP, YOU NEED TO FORK IT
|
| 157 |
|
| 158 |
the_plot = shap.plots.text(shap_values, display = False)
|
| 159 |
st.caption("Scroll to see the full output!")
|
|
|
|
| 7 |
[sys.executable, "-m", "pip", "install", package]
|
| 8 |
)
|
| 9 |
|
| 10 |
+
##Lines 1-8 are necessary because the normal requirements.txt path for installing a package from disk doesn't work on HF spaces, thank you to Omar Sanseviero for the help!
|
| 11 |
|
| 12 |
import numpy as np
|
| 13 |
import pandas as pd
|
|
|
|
| 29 |
st.title("SHAP (SHapley Additive exPlanations)")
|
| 30 |
st.image("https://shap.readthedocs.io/en/latest/_images/shap_header.png", width = 700)
|
| 31 |
st.caption("By Lundberg, Scott M and Lee, Su-In")
|
| 32 |
+
st.caption("Slightly modified by Allen Roush to fix a bug with text plotting not working outside of Jupyter Notebooks")
|
| 33 |
st.caption("Full Citation: https://raw.githubusercontent.com/slundberg/shap/master/docs/references/shap_nips.bib")
|
| 34 |
st.caption("See on github:: https://github.com/slundberg/shap")
|
| 35 |
+
st.caption("More details of how SHAP works: https://christophm.github.io/interpretable-ml-book/shap.html")
|
| 36 |
|
| 37 |
|
| 38 |
form = st.sidebar.form("Main Settings")
|
|
|
|
| 155 |
shap_values = explainer([doc])
|
| 156 |
|
| 157 |
|
|
|
|
| 158 |
|
| 159 |
the_plot = shap.plots.text(shap_values, display = False)
|
| 160 |
st.caption("Scroll to see the full output!")
|