Iโm creating a dashboard (here) that requires quite a lot of data wrangling, and trying to use the @st.cache decorator to improve performance after user input with *st.selectbox*
My function call other functions. All the inner functions have the decorator as well (code here). It looks like:
@st.cache(persist=True, allow_output_mutation=True)
def wrapper_chart_emotion(df_emo_answers, emotion, ethnicity):
df = emotion_df_formated_et(df_emo_answers, emotion, ethnicity) # subset 'anger' rows
df_formated_ans = df.drop(['photo_id', 'ethnicity', 'sex','age', 'label', 'url'], axis=1)
df_count = count_freq_labels(df_formated_ans) # count label freq
chart = simple_per_bar(
df_count, \
title='Expected label: '+ emotion + ' | n = '+ df_count['counts'].sum().astype(str), \
emotion=emotion.capitalize())
return chart
Yet, I see no performance improvement on re-loading the site. Am I missing something?