Skip to content

Commit

Permalink
fix: prevent progress bar value exceeding 100% (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyhoo authored Nov 13, 2024
1 parent 3d07976 commit 52d7ce6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/autogluon_assistant/ui/log_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,16 @@ def process_realtime_logs(line):
st.session_state.increment_time += 1
if st.session_state.increment_time <= TIME_LIMIT_MAPPING[st.session_state.time_limit]:
progress_bar = st.session_state.progress_bar
current_time = st.session_state.increment_time + 1
current_time = min(
st.session_state.increment_time + 1,
TIME_LIMIT_MAPPING[st.session_state.time_limit],
)
progress = current_time / TIME_LIMIT_MAPPING[st.session_state.time_limit]
time_ratio = f"Elapsed Time for Fitting models: | {current_time}/{TIME_LIMIT_MAPPING[st.session_state.time_limit]} ({progress:.1%})"
progress_bar.progress(current_time, text=time_ratio)
time_ratio = (
f"Elapsed Time for Fitting models: | "
f"{current_time}/{TIME_LIMIT_MAPPING[st.session_state.time_limit]} ({progress:.1%})"
)
progress_bar.progress(progress, text=time_ratio)
if not st.session_state.show_remaining_time:
st.session_state.stage_container[st.session_state.current_stage].append(line)
show_log_line(line)
Expand Down

0 comments on commit 52d7ce6

Please sign in to comment.