Spaces:
Runtime error
Runtime error
import streamlit as st | |
from state import provide_state | |
import json | |
INITIAL_CONF = { | |
"checkbox": False, | |
"number": 0.0 | |
} | |
def main(state): | |
query_params = st.experimental_get_query_params() | |
if "conf" in query_params: | |
state.conf = json.loads(query_params["conf"][0]) | |
state.conf = state.conf or INITIAL_CONF | |
state.conf["checkbox"] = st.checkbox("Retain State !", value=state.conf["checkbox"]) | |
state.conf["number"] = st.number_input("You Too Retain State !", value=state.conf["number"]) | |
st.experimental_set_query_params(**{"conf": json.dumps(state.conf)}) | |
main() |