Don't run code unless variables are all set

Hello! I’ve got an algo which:
1.Fetches data from db (i only need it once)
2. Data processing and df creation
3.Running ML algo with input variables (st.number_input(), 3 vars)
I want my Streamlit app not to reload every time I enter new variable. How can I do this?

I don’t think streamlit currently supports what you want.
What you can do, if it helps, is to set the ML algorithm inside a condition to only run when the 3 input vars are present. That way, even on the case of a re-run the time it takes to reload is very short.

Yeah, it is fast but so annoying :smiley:

1 Like