awacke1 commited on
Commit
ca8fbc6
·
1 Parent(s): ecf3beb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -1,21 +1,20 @@
1
  import streamlit as st
2
- from state import provide_state
3
- import json
4
 
5
- INITIAL_CONF = {
6
- "checkbox": False,
7
- "number": 0.0
8
- }
9
 
10
- @provide_state
11
- def main(state):
 
 
 
12
  query_params = st.experimental_get_query_params()
13
- if "conf" in query_params:
14
- state.conf = json.loads(query_params["conf"][0])
15
- state.conf = state.conf or INITIAL_CONF
 
 
 
 
16
 
17
- state.conf["checkbox"] = st.checkbox("Retain State !", value=state.conf["checkbox"])
18
- state.conf["number"] = st.number_input("You Too Retain State !", value=state.conf["number"])
19
- st.experimental_set_query_params(**{"conf": json.dumps(state.conf)})
20
 
21
- main()
 
 
1
  import streamlit as st
 
 
2
 
 
 
 
 
3
 
4
+ def show_main_settings():
5
+ st.write(f'Hi {st.session_state.query_params}')
6
+
7
+
8
+ def run_dash():
9
  query_params = st.experimental_get_query_params()
10
+ st.session_state.query_params = query_params
11
+
12
+ if 'id' in query_params:
13
+ show_main_settings()
14
+ else:
15
+ st.write('Malformed URL, missing id.')
16
+ st.write(query_params)
17
 
 
 
 
18
 
19
+ if __name__ == '__main__':
20
+ run_dash()