Streamlit-shap - A static component to display SHAP plots in Streamlit

I found it tricky to display SHAP (static and interactive) plots in Streamlit.

Those of you who’ve tried in the past have likely had to write custom wrappers to display interactive SHAP plots (that use JS) in Streamlit apps, and reuse the wrapper code across multiple projects. I realized I could save you the effort by packaging it into a Streamlit Component :smiley:

streamlit-shap
GitHub repo
PyPI project

LMK what you think! Contributions are more than welcome :technologist:

7 Likes

This is great @snehankekre - do you have any examples of using this with DNNs?

@asehmi Not at the moment. Great suggestion though. I will add a couple in the coming days.

In the meantime, feel free to have to look at any DNN examples in the SHAP repo. Adapting them to Streamlit should as simple as wrapping the final shap. call in the examples with st_shap() (provided the linked examples aren’t outdated/broken).

2 Likes

That would be great if you have time. Thanks, @snehankekre .

Hi @asehmi,

I’ve added two deep learning examples in v1.0.2. They’re heavily based on examples from the SHAP repo.

@snehankekre Amazing. I’ll have a look. Thanks a million.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.