oegedijk / explainerdashboard

Quickly build Explainable AI dashboards that show the inner workings of so-called "blackbox" machine learning models.
http://explainerdashboard.readthedocs.io
MIT License
2.3k stars 332 forks source link

Running Explainer Dashboard in streamlit #203

Closed eakande closed 2 years ago

eakande commented 2 years ago

Is there a way I can run and successfully deploy ExplainerDashboard inside streamlit? the code below run successfully on localhost but could not successfully deploy. Hence, I decided to ask the question in case you know a better way on how to go about this.

def app():

st.title("This is the machine learning page")
st.markdown("redirect to my [app](https://github.com/prakharrathi25/data-storyteller/blob/main/app.py)")

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')
st.dataframe(data)

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

# Convert y to labels 
y = y.map({'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()
model.fit(X_train, y_train)

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

explainer = ClassifierExplainer(model, X_test, y_test)
ExplainerDashboard(explainer).run(mode='external')

st.markdown("Check out the [explainer dashboard](http://192.168.1.3:8050/)")
oegedijk commented 2 years ago

Hi @eakande,

I don't use streamlit myself, so not sure I can directly help, but if you can post some error/logs/stacktraces maybe someone else can?

eakande commented 2 years ago

Thanks but is it possible to deploy this dashboard and upload data directly into it after being deployed? that way, if I upload my data online, the dashboard can read the data and push out the results. I need help doing this.

Talador12 commented 2 years ago

I am also interested in this use case. I think this might be something I build out and see where we run into issues

eakande commented 2 years ago

@Talador12 it will be great to see this, I have tried so many times but I couldn't get through it because I am not as vast as so many of you.