From 0b3ec7e92fec40a412322028a992307db0defbb1 Mon Sep 17 00:00:00 2001 From: Ovler Date: Tue, 19 Nov 2024 05:02:05 -0500 Subject: [PATCH] feat: enhance metadata retrieval process with progress indicators --- src/ia_collection_analyzer/streamlit.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ia_collection_analyzer/streamlit.py b/src/ia_collection_analyzer/streamlit.py index 0e87e505..ec9facbd 100644 --- a/src/ia_collection_analyzer/streamlit.py +++ b/src/ia_collection_analyzer/streamlit.py @@ -19,11 +19,18 @@ st.stop() # display we're getting the metadata -st.write("Getting metadata for collection:", collection_id) - -# display the ids +progress_text = st.text(f"Getting metadata for collection: {collection_id}, please wait...") +progress_bar = st.progress(0) items = get_collection_items_metadata(collection_id) +progress_text.text(f"Getting metadata for collection: {collection_id}, transforming data...") +progress_bar.progress(95) items_pd = pd.DataFrame(items) +progress_text.text(f"Getting metadata for collection: {collection_id}, cleaning data...") +# drop columns with 80%+ nan +items_pd = items_pd.dropna(axis=1, thresh=0.8 * len(items_pd)) +progress_text.text(f"Getting metadata for collection: {collection_id}, done!") + +progress_bar.progress(100) st.write("The collection contains the following items:") st.write(items_pd)