Hello I have an app that interact with a ML model and returns a score when I input values through sliders but I also have a drag and drop button where I drop a dataframe and interact with my model then return a prediction. The probleme is after being used, the drag and drop button freeze my other page widgets. How can I solve this to reset the drag and drop state ?
@app.callback(
Output('output-data-upload', 'children'),
Output('model-output', 'children'),
Output('reset-store', 'data'),
Input('upload-data', 'contents'),
State('upload-data', 'filename'),
Input('age-slider', 'value'),
Input('for-slider', 'value'),
Input('rek-slider', 'value'),
Input('hmg-slider', 'value'),
Input('gonal-slider', 'value'),
Input('ov-slider', 'value'),
Input('policy-radio', 'value'),
Input('registered-radio', 'value'),
Input('apem-radio', 'value'),
Input('reset_button', 'n_clicks'),
State('reset-store', 'data'),
)
def update_output(list_of_contents, list_of_names, value_age, value_for, value_rek, value_hmg, value_gonal, value_ov, value_policy, value_registered, value_apem, n_clicks, reset_data):
ctx = dash.callback_context
if not ctx.triggered:
return None, None, reset_data
triggered_id = ctx.triggered[0]['prop_id'].split('.')[0]
if triggered_id == 'reset_button':
return None, None, {'reset': True}
if reset_data['reset']:
return None, None, {'reset': False}
if list_of_contents is not None:
for contents, name in zip(list_of_contents, list_of_names):
df = parse_contents(contents, name)
else:
input_dict = {
'age': value_age,
'for_user': value_for,
'rek_user': value_rek,
'hmg_user': value_hmg,
'gonal_user': value_gonal,
'ov_user': value_ov,
'policy': value_policy,
'registered_not_joined_3months': value_registered,
'apem_status_opened_and_clicked': value_apem
}
columns_order = ['policy', 'hmg_user', 'registered_not_joined_3months', 'age', 'gonal_user', 'ov_user', 'apem_status_opened_and_clicked', 'rek_user', 'for_user']
df = pd.DataFrame([input_dict], columns=columns_order)
prediction_output = predict_proba_return_html(pipeline, df)
return None, prediction_output, reset_data