Avoid fading output during longer background activity

following up on this:

what I did in my script was, that I separated calculation/data acquisition tasks, work(), from the stuff that does the displaying via streamlit, ui(). The script first runs ẁork() followed by ui(). What I observed, was that work() blocked part of streamlit activity which resulted in grayed-out widgets.

However, I now simply reversed the sequence, i.e. first ui() and than work(), which leads to better displaying performance. It might be necessary to do a st.experimental_rerun(), though, to update things in the UI.

Another solution is the use of asynchronous routines via asyncio as describe in this discussion:

I am still wondering, what’s the speediest way to display 2D/image data using streamlit.

Best wishes
Markus