Created
February 28, 2020 18:44
-
-
Save monchier/0c2f54864fc1e87e44c2629f21d9d9ef to your computer and use it in GitHub Desktop.
st.cache for mutable state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
@st.cache(allow_output_mutation=True) | |
def get_mutable(): | |
return [] | |
x = st.sidebar.slider("Choose x value: ", 0, 10) | |
mutable_object = get_mutable() | |
mutable_object.append(x) | |
st.write(f"Choice history is {mutable_object}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment