Skip to content

Commit

Permalink
Merge pull request #866 from dianna-ai/865-Updating-READMEs-issues-81…
Browse files Browse the repository at this point in the history
…5-863

Updating READMEs (issues 815 and 863)
  • Loading branch information
cwmeijer authored Oct 30, 2024
2 parents 4500fac + 3caed30 commit 8480543
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 67 deletions.
66 changes: 44 additions & 22 deletions README.md

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions dianna/dashboard/Home.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import importlib
import streamlit as st
from _shared import add_sidebar_goddess_logo
from _shared import data_directory
from streamlit_option_menu import option_menu

Expand Down Expand Up @@ -38,7 +39,7 @@

# Display the content of the selected page
if selected == "Home":

add_sidebar_goddess_logo()
_, col, _ = st.columns([1, 3, 1])
with col:
st.markdown("""#""")
Expand Down Expand Up @@ -90,10 +91,8 @@
You can then select the explainer you want to use and set its hyperparameters.
### More information
- [Source code](https://github.com/dianna-ai/dianna)
- [Research Software directory page](https://research-software-directory.org/software/dianna)
- [Documentation](https://dianna.readthedocs.io/)
- [XAI choice](https://blog.esciencecenter.nl/how-to-find-your-artificial-intelligence-explainer-dbb1ac608009)
""",
unsafe_allow_html=True)

Expand Down
3 changes: 3 additions & 0 deletions dianna/dashboard/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def add_sidebar_logo():
"""Upload DIANNA logo to sidebar element."""
st.sidebar.image(str(data_directory / 'logo.png'))

def add_sidebar_goddess_logo():
"""Upload DIANNA goddess logo to sidebar element."""
st.sidebar.image(str(data_directory / 'Diana_goddess.png'))

def _methods_checkboxes(*, choices: Sequence, key):
"""Get methods from a horizontal row of checkboxes and the corresponding parameters."""
Expand Down
32 changes: 6 additions & 26 deletions dianna/dashboard/readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# DIANNA dashboard

<!-- ![Dianna dashboard screenshot](./dashboard-screenshot.png) -->
_Dianna dashboard screenshot here_

The DIANNA dashboard can be used for simple exploration of your trained model explained by DIANNA. The dashboard produces the visual explanation of your selected XAI method. Additionally it allows you to compare the results of different XAI methods, as well as explanations of the top ranked predicted labels. The dashboard was created using [streamlit](https://streamlit.io/).
The DIANNA dashboard (powered by [streamlit](https://streamlit.io/) <img width="25" alt="Streamlit Logo" src="https://github.com/user-attachments/assets/2cac7d5d-c11a-48fe-b58e-71b15baaa163">) can be used for explanation of ONNX models trained for the tasks and datasets presented in several (marked with <img width="25" alt="Streamlit Logo" src="https://github.com/user-attachments/assets/2cac7d5d-c11a-48fe-b58e-71b15baaa163">) of the DIANNA [tutorials](../../tutorials/README.md).
The dashboard shows the visual explanation of a models' decision on a selected data item by a selected XAI method (explainer). Results of different explainers can be compared, as well as explanations of the top predicted labels.

To open the dashboard, you can install dianna via `pip install -e '.[dashboard]'` and run:

Expand All @@ -21,26 +19,8 @@ Open the link on which the app is running. Note that you are running the dashboa

## How to use the dashboard

The dashboard will automatically open in the welcome page tab. In the sidebar you can open the image or text pages.

### Images

- Click on select image and select an image saved on your computer for which you want the DIANNA explanation.
- Click on select model and select your trained model used for the prediction and explanation.
- Click on select labels and select a text file containing the labels of your trained model. Labels should be separated by line breaks in the file, no other separators should be used. Make sure that both the <ins>labels</ins> and <ins>ordering of the labels</ins> is correct in correspondence to your trained model.
- Check the XAI methods you want to use, multiple methods can be used at the same time for comparison.
- Your image explanation will start loading.

Additionally, you can:
- Select the number of top results you which to show the explanation for, i.e. if you use 2, the dashboard will show not only the explanation for the main prediction for the selected image, but also for the second most likely prediction.
- Set the method specific settings to the selected XAI methods. If you don't change these, the default values are used.

### Text

- Input the text you want to use in the "Input string" box. Press enter to update the explanation.
- Click on select model and select your trained model used for the prediction and explanation.
- Click on select labels and select a text file containing the labels of your trained model. Labels should be separated by line breaks in the file, no other separators should be used. Make sure that both the <ins>labels</ins> and <ins>ordering of the labels</ins> is correct in correspondence to your trained model.
- Check the XAI methods you want to use, multiple methods can be used at the same time for comparison.
- Your image explanation will start loading.
This [video](https://youtu.be/9VM5acip2s8) shows you how to use the DIANNA dashboard for some of the <img width="25" alt="Streamlit Logo" src="https://github.com/user-attachments/assets/2cac7d5d-c11a-48fe-b58e-71b15baaa163"> [tutorials](../../tutorials/README.md#summary-of-all-tutorials) to interactively explore the use cases from some of DIANNA's .
Similarly, you can use it with your own data, models and lables.

Additionally, you can set the method specific settings to the selected XAI methods. If you don't change these, the default values are used.
--------------------------------------------------------------------------
![image](https://github.com/user-attachments/assets/1a98920e-f75e-468c-bf1f-f6e8bd2273ad)
Binary file added dianna/data/Diana_goddess.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ notebooks =
torchvision
ipywidgets
freetype-py
transformers
transformers<4.46.0
xgboost

[options.entry_points]
Expand Down
Loading

0 comments on commit 8480543

Please sign in to comment.