Score more right on annotating, and ID at the left.

This commit is contained in:
2026-03-10 16:34:40 +01:00
parent f247a975d8
commit aa780134ed
3 changed files with 34 additions and 7 deletions
+12 -1
View File
@@ -145,6 +145,7 @@ def make_prompt(full_label):
from google import genai
from google.genai import types
import base64
import shlex
import json
from pathlib import Path
import os
@@ -218,6 +219,7 @@ start_time = time.time()
overwrite = args.overwrite
limit = args.limit
completed_tasks = []
errors_summary = []
# --- Lock for thread-safe file writing ---
io_lock = threading.Lock()
@@ -343,7 +345,10 @@ def process_single_task(task_tuple):
except json.JSONDecodeError:
print(f"Error decoding JSON for {file_path}", file=sys.stderr)
except Exception as e:
print(f"Exception processing {file_path}: {e}", file=sys.stderr)
error_msg = f"Exception processing {file_path}: {e}"
print(error_msg, file=sys.stderr)
with io_lock:
errors_summary.append((error_msg, file_path))
print(f"Starting processing on {len(tasks_to_process)} tasks with {NB_THREADS} threads...")
@@ -353,3 +358,9 @@ with concurrent.futures.ThreadPoolExecutor(max_workers=NB_THREADS) as executor:
end_time = time.time()
print("Time elapsed : ", end_time - start_time)
print("Requests to pro / flash : ", pro_count, flash_count)
if errors_summary:
print("\n--- Summary of Exceptions ---", file=sys.stderr)
for (err, file) in errors_summary:
print(err, file=sys.stderr)
escaped_path = shlex.quote(str(file_path))
print(f"Run : python correction.py {escaped_path}")