Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
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)
|