Hello all,
I have an intensive data crunching task that should ONLY get triggered by a new file being selected with the upload button. I then have a graph that should be updated when either a new file is uploaded (and data crunched) OR a new dropdown value is selected.
My data crunching callback is setup as:
@app.callback(
Output('intermediate-data', 'children'),
[Input('upload-new', 'contents')],
[State('upload-new', 'filename')])
def data_crunch(contents, filename):
and my graph update callback is setup as:
@app.callback(Output('My Graph', 'figure'), [Input('intermediate-data', 'children'),
Input('My Graph Dropdown', 'value')])
def update_graph(datasets, dropdown):
I have two issues:
- When I reload the webpage, the
data_crunch
function gets called. I only want it called when a file is uploaded via the upload button. - When a new dropdown value is selected, the
data_crunch
function runs.
How do achieve my goal/solve these problems? At a loss for figuring out why it’s doing what it’s doing.
Thanks!