Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -161,6 +161,43 @@ def display_content_or_image(query):
|
|
161 |
st.warning("No matching content or image found.")
|
162 |
return False
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
# Streamlit UI for displaying query parameters and handling actions
|
165 |
st.markdown("### Query Parameters - Navigate or Trigger Functionalities")
|
166 |
st.write("Current Query Parameters:", st.query_params())
|
|
|
161 |
st.warning("No matching content or image found.")
|
162 |
return False
|
163 |
|
164 |
+
|
165 |
+
|
166 |
+
# Old Query Params:
|
167 |
+
|
168 |
+
st.markdown("### Query Parameters - These Deep Link Map to Remixable Methods")
|
169 |
+
st.write("Current Query Parameters:", st.query_params)
|
170 |
+
|
171 |
+
# Example: Using query parameters to navigate or trigger functionalities
|
172 |
+
if 'action' in st.query_params:
|
173 |
+
action = st.query_params()['action'][0] # Get the first (or only) 'action' parameter
|
174 |
+
if action == 'show_message':
|
175 |
+
st.success("Showing a message because 'action=show_message' was found in the URL.")
|
176 |
+
elif action == 'clear':
|
177 |
+
clear_query_params()
|
178 |
+
st.experimental_rerun()
|
179 |
+
|
180 |
+
# Handling repeated keys
|
181 |
+
if 'multi' in st.query_params:
|
182 |
+
multi_values = get_all_query_params('multi')
|
183 |
+
st.write("Values for 'multi':", multi_values)
|
184 |
+
|
185 |
+
# Manual entry for demonstration
|
186 |
+
st.write("Enter query parameters in the URL like this: ?action=show_message&multi=1&multi=2")
|
187 |
+
|
188 |
+
# Clear query parameters button
|
189 |
+
if st.button("Clear Query Parameters"):
|
190 |
+
clear_query_params()
|
191 |
+
st.experimental_rerun()
|
192 |
+
|
193 |
+
|
194 |
+
|
195 |
+
|
196 |
+
|
197 |
+
# New Query Params:
|
198 |
+
|
199 |
+
|
200 |
+
|
201 |
# Streamlit UI for displaying query parameters and handling actions
|
202 |
st.markdown("### Query Parameters - Navigate or Trigger Functionalities")
|
203 |
st.write("Current Query Parameters:", st.query_params())
|