Add1E commited on
Commit
1888a81
·
verified ·
1 Parent(s): fee7f34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -8
app.py CHANGED
@@ -264,11 +264,11 @@ def check_password():
264
  """Checks whether a password entered by the user is correct."""
265
  if hmac.compare_digest(st.session_state["password"], os.environ.get("PASSWORD")):
266
  st.session_state["password_correct"] = True
267
- st.code("asdf")
268
  del st.session_state["password"] # Don't store the password.
269
  else:
270
  st.session_state["password_correct"] = False
271
- st.code("sad")
272
 
273
  # Return True if the password is validated.
274
  if st.session_state.get("password_correct", False):
@@ -285,10 +285,29 @@ def check_password():
285
 
286
  if not check_password():
287
  st.stop() # Do not continue if check_password is not True.
288
-
289
-
290
 
291
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  if 'selected_option' not in st.session_state:
294
  st.session_state['selected_option'] = "default_value" # You can set a default value as needed
@@ -323,12 +342,11 @@ if selected_option == "Tagesaktuelle Anfragen":
323
  elif selected_option == "Realzeit Anfragen":
324
 
325
  raw_choices_list = list(st.session_state["real_trending_searches"][selected_country].keys())
326
-
327
  cleaned_to_raw_mapping = {re.sub(r"\s\(\d+\)$", "", choice): choice for choice in raw_choices_list}
328
- choices_list = list(cleaned_to_raw_mapping.keys())
 
329
 
330
  auswahl = st.selectbox("Select Ressort", choices_list, index=0)
331
-
332
 
333
  display_articles_for_category(cleaned_to_raw_mapping[auswahl])
334
 
 
264
  """Checks whether a password entered by the user is correct."""
265
  if hmac.compare_digest(st.session_state["password"], os.environ.get("PASSWORD")):
266
  st.session_state["password_correct"] = True
267
+
268
  del st.session_state["password"] # Don't store the password.
269
  else:
270
  st.session_state["password_correct"] = False
271
+
272
 
273
  # Return True if the password is validated.
274
  if st.session_state.get("password_correct", False):
 
285
 
286
  if not check_password():
287
  st.stop() # Do not continue if check_password is not True.
 
 
288
 
289
+ fixed_order = [
290
+ "All categories",
291
+ "Autos and Vehicles",
292
+ "Beauty and Fashion",
293
+ "Business and Finance",
294
+ "Climate",
295
+ "Entertainment",
296
+ "Food and Drink",
297
+ "Games",
298
+ "Health",
299
+ "Hobbies and Leisure",
300
+ "Jobs and Education",
301
+ "Law and Government",
302
+ "Other",
303
+ "Pets and Animals",
304
+ "Politics",
305
+ "Science",
306
+ "Shopping",
307
+ "Sports",
308
+ "Technology",
309
+ "Travel and Transportation",
310
+ ]
311
 
312
  if 'selected_option' not in st.session_state:
313
  st.session_state['selected_option'] = "default_value" # You can set a default value as needed
 
342
  elif selected_option == "Realzeit Anfragen":
343
 
344
  raw_choices_list = list(st.session_state["real_trending_searches"][selected_country].keys())
 
345
  cleaned_to_raw_mapping = {re.sub(r"\s\(\d+\)$", "", choice): choice for choice in raw_choices_list}
346
+
347
+ choices_list = [category for category in fixed_order if category in cleaned_to_raw_mapping]
348
 
349
  auswahl = st.selectbox("Select Ressort", choices_list, index=0)
 
350
 
351
  display_articles_for_category(cleaned_to_raw_mapping[auswahl])
352