App model summary
Now that you know a little more about all the individual pieces, let's close the loop and review how it works together:
- Streamlit apps are Python scripts that run from top to bottom.
- Every time a user opens a browser tab pointing to your app, the script is executed and a new session starts.
- As the script executes, Streamlit draws its output live in a browser.
- Every time a user interacts with a widget, your script is re-executed and Streamlit redraws its output in the browser.
- The output value of that widget matches the new value during that rerun.
- Scripts use the Streamlit cache to avoid recomputing expensive functions, so updates happen very fast.
- Session State lets you save information that persists between reruns when you need more than a simple widget.
- Streamlit apps can contain multiple pages, which are defined in separate
.py
files in apages
folder.
Still have questions?
Our forums are full of helpful information and Streamlit experts.