Refreshing my app

Refreshing my app

Hi,
I want to use streamlit to have an easy way to display datas AND start collecting them.
I have a small python script that get a measure from a physical device and put values in a sqlite DB.
I would like my app to:

  • create/choose a DB (button, select box, ok)
  • start my script (button, ok)
  • display a chart coming from the chosen DB (panda, ok)
    I succeed in that statically, but my issues are now:
  • to loop to call my script. If I write my script to take measurements continuously in a loop, when I start the script with a subprocess, it freeze my streamlit app, like my script make streamlit app process busy all time
  • to update the chart when a call to my script is made

So, as I understood, streamlit script is read at start, and apparently each time an streamlit action is processed, like pressing a st.button… but is there a way to call my script repeatedly (loop) without freezing streamlit app ?

How can I control the update process, and also start a new one to get my measurement ?

Thanks for any kind of advice

Claude

Hi @moonmoon

@kmcgrady created a component called st_autorefresh that triggers Streamlit to rerun on a user-specified interval.

You can check out the links below:

Hope this helps!

Best regards,
Chanin