From 03e5de043c298984d23542079e86ecaedd6a2355 Mon Sep 17 00:00:00 2001 From: Tobias O Date: Wed, 3 Jan 2024 20:42:04 +0100 Subject: [PATCH] Add additional info about random data --- app/database.py | 4 ++-- streamlitapp.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/database.py b/app/database.py index 5242f13..fa1415d 100644 --- a/app/database.py +++ b/app/database.py @@ -30,11 +30,11 @@ def show_table(df: pd.DataFrame): ) # , update_mode='manual')#theme='alpine', -@st.cache_data(ttl=600, show_spinner=False) +@st.cache_data(ttl=60, show_spinner=False) def display_random_data(_db_conn, db_filter: DBFilter): with st.spinner("Loading random data..."): st.session_state.data = db.get_random_data(_db_conn, db_filter.num_sequences) - st.session_state.user_display = "The table below shows a random selection. Use the sidebar filters for a personalized selection." # noqa: E501 + st.session_state.user_display = "The table below shows a random selection. You can generate a new selection every 20 min. Use the sidebar filters for a personalized selection." # noqa: E501 @st.cache_data(ttl=600, show_spinner=False) diff --git a/streamlitapp.py b/streamlitapp.py index b1b879f..060235f 100644 --- a/streamlitapp.py +++ b/streamlitapp.py @@ -151,6 +151,10 @@ def handle_database_tab(db_conn): else: database.display_filtered_data(db_conn, database_filter) + if not st.st.session_state.user_display.empty: + st.write(st.session_state.user_display) + st.markdown("---") + if not st.session_state.data.empty: database.show_table(st.session_state.data) st.download_button(