Skip to content

save_html Method Not Saving Custom Tab in DashboardExplainer #303

@bocejo5

Description

@bocejo5

I am encountering an issue with the save_html method of the DashboardExplainer class. The problem is that this method does not save the custom tab that I have added to a DashboardExplainer object in the generated HTML file.

When I add a custom tab to a DashboardExplainer and then use the save_html method to save the dashboard as an HTML file, the custom tab does not appear in the resulting file. However, this behavior is not observed when using the run method, which correctly displays the custom tab.

from explainerdashboard import ClassifierExplainer, ExplainerDashboard

explainer = ClassifierExplainer(model, X_test, y_test)

class CustomTab(ExplainerComponent):
    def __init__(self, explainer, title="Custom Tab", name=None):
        super().__init__(explainer, title, name)

    def layout(self):
        return dbc.Container(
            [
                dbc.Row(
                    [
                        dbc.Col(
                            [
                                html.H3("Questo è un tab custom!"),
                                dcc.Markdown(
                                    """
                        Puoi aggiungere contenuti personalizzati qui, 
                        come tabelle, grafici, testi e altro.
                    """
                                ),
                            ]
                        )
                    ]
                )
            ]
        )

dashboard = ExplainerDashboard(explainer, tabs=[CustomTab, 'importances', 'model_summary'])

dashboard.save_html("dashboard.html")

# Running the dashboard works fine and displays the custom tab
# dashboard.run()

Expected Behavior

The custom tab "My Custom Tab" should appear in the "dashboard.html" file.

Actual Behavior

The custom tab "My Custom Tab" does not appear in the "dashboard.html" file.

Environment

explainerdashboard version: 0.4.5
Python version: 3.11.5
Operating system: Windows11

Additional Context

I have checked the documentation and tried different approaches to ensure the custom tab is correctly added before saving, but the issue persists. This functionality is critical for my use case, and any assistance would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions