Skip to content

Commit

Permalink
feat: Refract into fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovler-Young committed Nov 30, 2024
1 parent 85eecaa commit fa0d1b3
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 179 deletions.
7 changes: 5 additions & 2 deletions src/ia_collection_analyzer/getmetadatas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@


def fetch_metadata(collection_id):
progress_message = st.markdown("Getting count and estimating time...")
progress_message_text = "Getting count and estimating time..."
progress_message = st.markdown(progress_message_text)
progress_bar = st.progress(0)
items_processed = 0
start_time = time.time()

def progress_hook(add, total):
nonlocal items_processed
nonlocal progress_message_text
items_processed += add
progress = 0 if total == 0 else items_processed / total
current_time = time.time()
Expand All @@ -28,8 +30,9 @@ def progress_hook(add, total):
)
progress_message.markdown(last_progress_message)
progress_bar.progress(progress)
progress_message_text = last_progress_message

items = get_collection_items_metadata(collection_id, progress_hook)
progress_bar.progress(100)

return items
return items, progress_message_text
Loading

0 comments on commit fa0d1b3

Please sign in to comment.