Hi, I’m developing an app that takes a file input from a user (a xls in this case) turns it into a dataframe and performs some calculations using. At one point a user input is required, so I take a series of the dataframe, copy it (altough I allow output mutation in the functions that alter the df) and use it as the base for a multiselect object, but whenever I select a new item in this multiselect object the whole processing reloads. I have decorated with st.cache every processing function, so it doesn’t take long but it is really annoying as if I want to select 10 items I have to wait 10 times for this to happen. Can I avoid this some way? Am I doing something wrong?
I’m attaching the part of the code I mention
corpus = st.file_uploader('Insertar corpus de Preguntas (.xls)')
if corpus is not None:
with st.spinner('Procesando datos...'):
df, intents = procesado(pd.read_excel(corpus))
st.success('Procesando datos - Listo!')
with st.spinner('Preparando modelo...'):
model = modelo(word_model, df)
st.success('Preparando modelo - Listo!')
with st.spinner('Calculando distancias...'):
distancias = distancias(df, intents)
st.success('Calculando distancias - Listo!')
sel_ints = st.multiselect(label= 'Seleccionar los intents sobre los cuales evaluar las distancias: ', options = intents)