awacke1 commited on
Commit
c50215b
β€’
1 Parent(s): c4d8efa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -38,6 +38,27 @@ def factorial(n):
38
  #em09 = factorial(9) # Returns instantly!
39
  #print("em09:",em09)
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  DEVICE = "cpu"
42
  MODEL_OPTIONS = ["msmarco-distilbert-base-tas-b", "all-mpnet-base-v2"]
43
  DESCRIPTION = """
 
38
  #em09 = factorial(9) # Returns instantly!
39
  #print("em09:",em09)
40
 
41
+
42
+ # callback to update query param on selectbox change
43
+ def update_params():
44
+ st.experimental_set_query_params(option=st.session_state.qp)
45
+ options = ["cat", "dog", "mouse", "bat", "duck"]
46
+ query_params = st.experimental_get_query_params()
47
+ # set selectbox value based on query param, or provide a default
48
+ ix = 0
49
+ if query_params:
50
+ try:
51
+ ix = options.index(query_params['option'][0])
52
+ except ValueError:
53
+ pass
54
+ selected_option = st.radio(
55
+ "Param", options, index=ix, key="qp", on_change=update_params
56
+ )
57
+ # set query param based on selection
58
+ st.experimental_set_query_params(option=selected_option)
59
+
60
+
61
+
62
  DEVICE = "cpu"
63
  MODEL_OPTIONS = ["msmarco-distilbert-base-tas-b", "all-mpnet-base-v2"]
64
  DESCRIPTION = """