I want to display a status widget that gets its value from some external server (say, WebSocket).
I wouldn’t want to rerun the streamlit app to update the status widget, rather I’d want it to update itself every second on its own (possibly on the frontend).
Ideally, the component would look “organic”, in the sense that it would respect the current theme set in streamlit.
What’s the easiest way of achieving that?
You can make use of the time
module (namely the sleep
method to add a delay) when iterating through time. Make sure to first define a placeholder with st.empty()
and for each iteration you can display an update of the component of interest by assigning it to the placeholder.
Please see this blog (How to build a real-time live dashboard with Streamlit) particularly section 5 in order to see this in action.
Hope this helps!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.