/ src / inference_pipeline / frontend / tracker.py
tracker.py
 1  """
 2  Contains a class that gives me way for me to more conveniently advance 
 3  the various progress bars that I will have in the sidebar.
 4  
 5  rKeeping this object in main.py (its original location) causes the widgets in 
 6  whichever script calls the tracker to appear twice, so it needs 
 7  to live in a dedicated file.
 8  """
 9  import streamlit as st 
10  
11  class ProgressTracker:
12      def __init__(self, n_steps: int) -> None:
13          self.current_step = 0
14          self.n_steps = n_steps
15          self.header = st.sidebar.header("⚙️ Working Progress")
16          self.progress_bar = st.sidebar.progress(value=0)
17  
18      def next(self) -> None:
19          self.current_step += 1 
20          self.progress_bar.progress(self.current_step/self.n_steps)
21