Skip to content

Commit

Permalink
feat: improve layout for collection ID input and fmt code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovler-Young committed Nov 19, 2024
1 parent 0b3ec7e commit f10e324
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/ia_collection_analyzer/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,30 @@
"This is a simple web app that analyzes the metadata of an Internet Archive collection."
)


# input the collection name
collection_id = st.text_input("Enter the collection ID:", "speedydeletionwiki")

conform_button = st.button("Conform")
col1, col2 = st.columns([3, 1], vertical_alignment="bottom")
with col1:
collection_id = st.text_input("Enter the collection ID:", "speedydeletionwiki")
with col2:
conform_button = st.button("Conform")

if not conform_button:
st.stop()

# display we're getting the metadata
progress_text = st.text(f"Getting metadata for collection: {collection_id}, please wait...")
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_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...")
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!")
Expand Down

0 comments on commit f10e324

Please sign in to comment.