'Dash long_callback causing prevent_Intial_call to stop working
I am working on a project involving training and forecasting neural networks inside Dash. As the training takes a while and I'd like to output something while they are training, I wanted to implement long_callback. However when I changed the callbacks to long_callback, they began running when I first load the page despite prevent_inital_call being set to true, does anyone know anything about this?
@app.long_callback(
Output('forecast-htmldiv','children'),
Input('Forecast-Data-Button', 'n_clicks'),
manager=long_callback_manager,prevent_initial_call=True,)
def forecast(clicks):
#load and forecast model and save output
return "Succesfully forecasted Model"
@app.long_callback(
Output('upload_htmlDiv','children'),
Input('Train-Data-Button', 'n_clicks'),
manager=long_callback_manager,
prevent_initial_call=True,)
def trainNetworks(clicks):
#train neural network and save training file
return "success"
I've tried deleting the long_callback cache and moving around prevent_inital_call in the decorator list, to no avail
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
