Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- app.py +16 -1
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -1096,7 +1096,21 @@ with col_input:
|
|
| 1096 |
else:
|
| 1097 |
# Non-PDF processing (text, images) - process all at once
|
| 1098 |
total_items = len(items_list)
|
| 1099 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1100 |
|
| 1101 |
try:
|
| 1102 |
result_df = catllm.multi_class_ensemble(
|
|
@@ -1104,6 +1118,7 @@ with col_input:
|
|
| 1104 |
categories=categories_entered,
|
| 1105 |
models=[(model, model_source, actual_api_key)],
|
| 1106 |
input_description=description,
|
|
|
|
| 1107 |
)
|
| 1108 |
all_results = [result_df]
|
| 1109 |
|
|
|
|
| 1096 |
else:
|
| 1097 |
# Non-PDF processing (text, images) - process all at once
|
| 1098 |
total_items = len(items_list)
|
| 1099 |
+
|
| 1100 |
+
# Progress callback for item-by-item updates
|
| 1101 |
+
def item_progress_callback(current_idx, total, item_label):
|
| 1102 |
+
progress = current_idx / total if total > 0 else 0
|
| 1103 |
+
progress_bar.progress(min(progress, 1.0))
|
| 1104 |
+
|
| 1105 |
+
elapsed = time.time() - start_time
|
| 1106 |
+
if current_idx > 0:
|
| 1107 |
+
avg_time = elapsed / current_idx
|
| 1108 |
+
eta_seconds = avg_time * (total - current_idx)
|
| 1109 |
+
eta_str = f" | ETA: {eta_seconds:.0f}s" if eta_seconds < 60 else f" | ETA: {eta_seconds/60:.1f}m"
|
| 1110 |
+
else:
|
| 1111 |
+
eta_str = ""
|
| 1112 |
+
|
| 1113 |
+
status_text.text(f"Processing item {current_idx+1} of {total} ({progress*100:.0f}%){eta_str}")
|
| 1114 |
|
| 1115 |
try:
|
| 1116 |
result_df = catllm.multi_class_ensemble(
|
|
|
|
| 1118 |
categories=categories_entered,
|
| 1119 |
models=[(model, model_source, actual_api_key)],
|
| 1120 |
input_description=description,
|
| 1121 |
+
progress_callback=item_progress_callback,
|
| 1122 |
)
|
| 1123 |
all_results = [result_df]
|
| 1124 |
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
streamlit>=1.32.0
|
| 2 |
-
cat-llm[pdf]>=0.1.
|
| 3 |
mistralai
|
| 4 |
pydantic==2.10.6
|
| 5 |
huggingface_hub<0.27.0
|
|
|
|
| 1 |
streamlit>=1.32.0
|
| 2 |
+
cat-llm[pdf]>=0.1.10
|
| 3 |
mistralai
|
| 4 |
pydantic==2.10.6
|
| 5 |
huggingface_hub<0.27.0
|