BulatF commited on
Commit
06b8d71
1 Parent(s): e19bf91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -145,8 +145,9 @@ def process_reviews(df, review_column, class_names):
145
 
146
  raw_scores = classify_reviews(df[review_column].tolist())
147
  for i in range(0, len(raw_scores), BATCH_SIZE):
148
- review_counter += BATCH_SIZE
149
- progress_bar.progress(review_counter / total_reviews)
 
150
 
151
  with st.spinner('Generating classes...'):
152
  class_scores = classify_with_new_classes(df[review_column].tolist(), class_names)
 
145
 
146
  raw_scores = classify_reviews(df[review_column].tolist())
147
  for i in range(0, len(raw_scores), BATCH_SIZE):
148
+ review_counter += min(BATCH_SIZE, len(raw_scores) - i) # Avoids overshooting the total reviews count
149
+ progress = min(review_counter / total_reviews, 1) # Ensures progress does not exceed 1
150
+ progress_bar.progress(progress)
151
 
152
  with st.spinner('Generating classes...'):
153
  class_scores = classify_with_new_classes(df[review_column].tolist(), class_names)