Automatic dashboard refresh

Hi, I created a dashboard with streamlit, but the data that I use changes all days. How can I make that dashboard refresh automatically once a day?

Hi @Nicolas_Parra_Avila,

How do you load your data in your streamlit dashboard? If you refresh your input data, it will update your dashboard accordingly.

2 Likes

Hi @Nicolas_Parra_Avila, welcome to the Streamlit forum!

Per @arnaud’s comment, we provide an example of doing this in the streamlit hello demo:

import streamlit as st
import time
import numpy as np

progress_bar = st.sidebar.progress(0)
status_text = st.sidebar.empty()
last_rows = np.random.randn(1, 1)
chart = st.line_chart(last_rows)

for i in range(1, 101):
    new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0)
    status_text.text("%i%% Complete" % i)
    chart.add_rows(new_rows)
    progress_bar.progress(i)
    last_rows = new_rows
    time.sleep(0.05)

progress_bar.empty()

# Streamlit widgets automatically run the script from top to bottom. Since
# this button is not connected to any other logic, it just causes a plain
# rerun.
st.button("Re-run")

For once per day, you might pursue a different means for doing the sleep component, but this demo can hopefully get you on the right track.

Best,
Randy

Hi @randyzwitch, in your example st.button(“Re-run”),

  • is that a visible button? and
  • will the user need to click to re-run?

Yes, it is a visible button for the user to click to re-run the demo.