awacke1 commited on
Commit
7900d25
1 Parent(s): f12ce5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -137,21 +137,21 @@ https://github.com/AaronCWacker/ThreeDragons
137
 
138
  # Function to handle repeated query parameters
139
  def get_all_query_params(key):
140
- return st.experimental_get_query_params().get(key, [])
141
 
142
  # Function to clear all query parameters
143
  def clear_query_params():
144
- st.experimental_set_query_params() # Clear by setting to empty
145
 
146
 
147
  st.title("Query Parameters Demo")
148
 
149
  # Display current query parameters
150
- st.write("Current Query Parameters:", st.experimental_get_query_params())
151
 
152
  # Example: Using query parameters to navigate or trigger functionalities
153
- if 'action' in st.experimental_get_query_params():
154
- action = st.experimental_get_query_params()['action'][0] # Get the first (or only) 'action' parameter
155
  if action == 'show_message':
156
  st.success("Showing a message because 'action=show_message' was found in the URL.")
157
  elif action == 'clear':
@@ -159,7 +159,7 @@ if 'action' in st.experimental_get_query_params():
159
  st.experimental_rerun()
160
 
161
  # Handling repeated keys
162
- if 'multi' in st.experimental_get_query_params():
163
  multi_values = get_all_query_params('multi')
164
  st.write("Values for 'multi':", multi_values)
165
 
 
137
 
138
  # Function to handle repeated query parameters
139
  def get_all_query_params(key):
140
+ return st.query_params().get(key, [])
141
 
142
  # Function to clear all query parameters
143
  def clear_query_params():
144
+ st.query_params() # Clear by setting to empty
145
 
146
 
147
  st.title("Query Parameters Demo")
148
 
149
  # Display current query parameters
150
+ st.write("Current Query Parameters:", st.query_params())
151
 
152
  # Example: Using query parameters to navigate or trigger functionalities
153
+ if 'action' in st.query_params():
154
+ action = st.query_params()['action'][0] # Get the first (or only) 'action' parameter
155
  if action == 'show_message':
156
  st.success("Showing a message because 'action=show_message' was found in the URL.")
157
  elif action == 'clear':
 
159
  st.experimental_rerun()
160
 
161
  # Handling repeated keys
162
+ if 'multi' in st.query_params():
163
  multi_values = get_all_query_params('multi')
164
  st.write("Values for 'multi':", multi_values)
165