streamlit auto refresh

Solutions on MaxInterview for streamlit auto refresh by the best coders in the world

showing results for - "streamlit auto refresh"
Fabio
29 Nov 2019
1import streamlit as st
2from streamlit_autorefresh import st_autorefresh
3
4# Run the autorefresh about every 2000 milliseconds (2 seconds) and stop
5# after it's been refreshed 100 times.
6count = st_autorefresh(interval=2000, limit=100, key="fizzbuzzcounter")
7
8# The function returns a counter for number of refreshes. This allows the
9# ability to make special requests at different intervals based on the count
10if count == 0:
11    st.write("Count is zero")
12elif count % 3 == 0 and count % 5 == 0:
13    st.write("FizzBuzz")
14elif count % 3 == 0:
15    st.write("Fizz")
16elif count % 5 == 0:
17    st.write("Buzz")
18else:
19    st.write(f"Count: {count}")
20