I’m working on a streamlit dashboard which loads live data, predicts and displays a plotly chart.
I’ve got it all working, but I’m stuck on how to make it rerun every 5 minutes. Is there an elegant way to do this in streamlit?
Currently I was thinking of just putting the whole streamlit output in a while loop like:
@cache
get_live_data(time)
# all the
while True:
time.sleep(5_mins)
data = get_live_data # this gets new data but how to rerun the script now?
# or do i need to put all the stuff inside the while loop like so
while True
all_the_code()
time.sleep(5_mins)
but, since the script never ends, what does that mean for streamlit? Is this a bad thing? does streamlit expect things to end at some point?
I’d love to have a streamlit call like st.rerun(after=5 minutes)
which I can stick anywhere and it just autoruns.