Trigger a dash dashboard with a button
Hi everyone. This is a cross-post with stackoverflow since I haven't been able to get any answer yet. (https://stackoverflow.com/q/72898620/2309097)
I am working on a Dataiku plugin, where I try to integrate ExplainerDashboard ( https://explainerdashboard.readthedocs.io/en/latest/index.html). Both use Dash and I initiate it like this:
predictor = ... X_test = ... y_true = ... explainer = RegressionExplainer(predictor._clf, X_test, y_true, n_jobs = 8) db = ExplainerDashboard(explainer, shap_interaction=True) app.config.external_stylesheets = [dbc.themes.BOOTSTRAP] app.layout = db.explainer_layout.layout() db.explainer_layout.register_callbacks(app)
And the Dataiku webview automatically load the ExplainerDashboard when I open the page. However, it has a timeout that is not configurable and some models takes more than the time limit. What I try to do is to open the Dataiku dash page where I have some information in text and a button that will say "Open the dashboard". Then when one clicks it, the whole layout will be replaced with the ExplainerDashboard.
I tried like this, but the dashboard opens empty without data in the plots (and the styling is also not bootstrap).
app.layout = html.Div([ html.Button('Submit', id='submit', n_clicks=0), html.Div(id='container-button-basic', children='Click to open the dashboard') ]) @app.callback( Output('container-button-basic', 'children'), Input('submit', 'n_clicks'), ) def update_output(n_clicks): predictor = ... X_test = ... y_true = ... explainer = RegressionExplainer(predictor._clf, X_test, y_true, n_jobs = 8) db = ExplainerDashboard(explainer, shap_interaction=True) app.config.external_stylesheets = [dbc.themes.BOOTSTRAP] app.layout = db.explainer_layout.layout() db.explainer_layout.register_callbacks(app)
Do you have any idea how I could do that work with a button instead?
Answers
-
CoreyS Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Registered Posts: 1,150 ✭✭✭✭✭✭✭✭✭
Hi, @tasosventouris
I was wondering if you had any luck over at Stack Overflow? If you have, would you be willing to share your solution with our Community? If not no worries and thank you regardless!