Skip to content

Commit

Permalink
fix: prevent progress bar value exceeding 100%
Browse files Browse the repository at this point in the history
- Cap current_time at time limit using min()
- Use normalized progress ratio (0-1) instead of raw time value
- Fixes StreamlitAPIException when progress exceeds 100
  • Loading branch information
tonyhoo committed Nov 12, 2024
1 parent 2334a49 commit f97ee71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/autogluon_assistant/ui/log_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ 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)
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 f97ee71

Please sign in to comment.