I am working on a dashboard with Dash. The problem is that the server has a default timeout of 60 seconds when I start the Dash, but the timeout is not there for callbacks. So, when I calculate everything during Dash initialization, I get the timeout.
When I try to run it like this,
X_train, y_train, X_test, y_test = titanic_survive()
model = LogisticRegression().fit(X_train, y_train)
explainer = ClassifierExplainer(model, X_test, y_test)
db = ExplainerDashboard(explainer, shap_interaction=False)
db.explainer_layout.register_callbacks(app)
app.layout = db.explainer_layout.layout()
I get the timeout on start up. I thought, I might load the Dash with a landing page and put the computations into a button click.
app.layout = html.Div([
html.Button('Submit', id='submit', n_clicks=0),
html.Div(id='container-button-basic', children='')
])
X_train, y_train, X_test, y_test = titanic_survive()
model = LogisticRegression().fit(X_train, y_train)
explainer = ClassifierExplainer(model, X_test, y_test)
@app.callback(
Output('container-button-basic', 'children'),
Input('submit', 'n_clicks'),
)
def update_output(n_clicks):
if n_clicks == 1:
db = ExplainerDashboard(explainer, shap_interaction=False)
db.explainer_layout.register_callbacks(app)
return db.explainer_layout.layout()
However, when I do it like this, the “db.explainer_layout.register_callbacks(app)” doesn’t seem to work. I get the dashboard but it looks the register callback doesn’t work and all the plots are empty.
The ExplainerDashboard is a Python package explainerdashboard — explainerdashboard 0.2 documentation
I don’t have access to the server since I run this through Dataiku. So, I am not sure how to proceed.