gvlktejaswi commited on
Commit
9d532dd
·
verified ·
1 Parent(s): c674b5c

Update page_files/Categorized_Search.py

Browse files
Files changed (1) hide show
  1. page_files/Categorized_Search.py +6 -5
page_files/Categorized_Search.py CHANGED
@@ -456,13 +456,12 @@ st.markdown(
456
  unsafe_allow_html=True,
457
  )
458
 
459
-
460
- @st.cache_data
461
  def load_data(material_type: str) -> pd.DataFrame:
462
  return load_material_data(material_type)
463
 
464
 
465
- @st.cache_data
466
  def load_all_data() -> pd.DataFrame:
467
  frames = []
468
  for material_type in ["Composites", "Polymers", "Fibers"]:
@@ -471,8 +470,7 @@ def load_all_data() -> pd.DataFrame:
471
  frames.append(frame)
472
  return pd.concat(frames, ignore_index=True)
473
 
474
-
475
- @st.cache_data
476
  def get_all_sections_cached() -> list:
477
  # get_all_sections() re-queries the DB directly (bypassing load_data's
478
  # cache) every time it's called. Wrapping it here means the 3 DB round
@@ -844,6 +842,9 @@ with right_col:
844
  )
845
  with btn_col:
846
  search_clicked = st.button("Search", key="top_search_btn", width="stretch")
 
 
 
847
 
848
  current_input = (search_query or "").strip()
849
  previous_term = st.session_state._search_term or ""
 
456
  unsafe_allow_html=True,
457
  )
458
 
459
+ @st.cache_data(ttl=60)
 
460
  def load_data(material_type: str) -> pd.DataFrame:
461
  return load_material_data(material_type)
462
 
463
 
464
+ @st.cache_data(ttl=60)
465
  def load_all_data() -> pd.DataFrame:
466
  frames = []
467
  for material_type in ["Composites", "Polymers", "Fibers"]:
 
470
  frames.append(frame)
471
  return pd.concat(frames, ignore_index=True)
472
 
473
+ @st.cache_data(ttl=60)
 
474
  def get_all_sections_cached() -> list:
475
  # get_all_sections() re-queries the DB directly (bypassing load_data's
476
  # cache) every time it's called. Wrapping it here means the 3 DB round
 
842
  )
843
  with btn_col:
844
  search_clicked = st.button("Search", key="top_search_btn", width="stretch")
845
+ if st.button("🔄 Refresh", key="refresh_data_btn", width="stretch"):
846
+ st.cache_data.clear()
847
+ st.rerun()
848
 
849
  current_input = (search_query or "").strip()
850
  previous_term = st.session_state._search_term or ""