I was able to achieve initialization by updating the slider key to a new one at the time of resetting.
https://discuss.streamlit.io/t/reseting-the-app-via-a-button/705
import SessionState
import streamlit as st
def create_slider(state):
if state.frag_slider_reset:
state.reset_num += 1
for name in ["a","b"]:
state.params[name] = st.slider(name,0,100,0,1,key=str(state.reset_num))
state.frag_slider_reset = False
state = SessionState.get(params=None,reset_num=0,frag_slider_reset=False)
state.params = {}
if st.button("reset"):
state.frag_slider_reset = True
create_slider(state)
st.write(state.params,state.reset_num)
Hey,@snehankekre.
Does this method cause memory issues?