Divers, en lien avec DMI04 (gemini_for_enonce.py, smaller images, link to enonce.pdf)

This commit is contained in:
2026-05-09 16:26:01 +02:00
parent 8d9165d0ac
commit 0836d5809d
9 changed files with 202 additions and 59 deletions
+1 -13
View File
@@ -582,7 +582,7 @@ Here is a list of all possible labels. You need to answer with a list one of the
height = grouping.get_pdf_height(str(new_pdf_path))
grouping.create_jpg(add_label, idx, [(pid, str(new_pdf_path), height)], INPUT_DIR)
new_tasks.append((str(Path(INPUT_DIR) / add_label / f"Group_{idx+1}.jpg"),
add_label, False, f"{label}(->)"))
add_label, False))
error += f"(->){add_label}"
keep_error = True
else:
@@ -603,7 +603,6 @@ def process_single_task(task_tuple, precomputed_response=None):
file_path = task_tuple[0]
label = task_tuple[1]
can_spawn_tasks = task_tuple[2] if len(task_tuple) > 2 else True
injected_error = task_tuple[3] if len(task_tuple) > 3 else ""
group_name = os.path.splitext(file_path)[0]
json_path = group_name + '.json'
@@ -649,15 +648,6 @@ def process_single_task(task_tuple, precomputed_response=None):
for p in json_data:
pid = p["id"]
res = p["result"]
# Inject additional error if present
if injected_error:
if res["error"]:
res["error"] = f"{injected_error} {res['error']}"
else:
res["error"] = injected_error
yming, ymaxg, width_r = d_data[pid]
pdf_path = Path(INPUT_DIR) / f"Copie{pid}" / f"{label}.pdf"
@@ -720,8 +710,6 @@ def process_single_task(task_tuple, precomputed_response=None):
tprint(f"Error decoding JSON for {file_path}", file=sys.stderr)
except Exception as e:
error_msg = f"Exception processing {file_path}: {e}"
import traceback
traceback.print_exc() # <--- Add this line to see the real crash
print(error_msg, file=sys.stderr)
with io_lock:
errors_summary.append((error_msg, file_path))