Run ExplainerDashboard inside a streamlit application

I want to run the ExplainerDashboard inside a Streamlit application. Is there a way I can do that? I have tried all modes of ExplainerDashboard run() function but it still isn’t working for me.

Here is what I have done so far but it doesn’t work.

from sklearn.model_selection import train_test_split
import streamlit as st
import pandas as pd
from explainerdashboard import ClassifierExplainer, ExplainerDashboard
from sklearn.linear_model import LogisticRegression 
from sklearn.model_selection import train_test_split

def app():
    st.title("This is the machine learning page")
    st.markdown("redirect to my [app](")

    st.write("This is an example of a Streamlit app - machine learning")
    # show the same data in the machine learning page 
    data = pd.read_csv('data/iris.csv')

    # Divide X and y 
    X = data[['A', 'B', 'C', 'D']]
    y = data['E']

    # Convert y to labels 
    y ={'Iris-setosa': 0, 'Iris-versicolor': 1, 'Iris-virginica': 2})

    X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.8)

    model = LogisticRegression(), y_train)

    st.write(model) # the code only runs till here

    explainer = ClassifierExplainer(model, X_test, y_test)

    st.markdown("Check out the [explainer dashboard](")

Hi @prakharrathi25 -

Since it looks like ExplainerDashboard is opening it’s own instance on your local machine, I think you should be able to iframe it into your page: