Yellow labels, and injected error for new spawned tasks.
This commit is contained in:
+11
-1
@@ -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))
|
||||
add_label, False, f"{label}(->)"))
|
||||
error += f"(->){add_label}"
|
||||
keep_error = True
|
||||
else:
|
||||
@@ -603,6 +603,7 @@ 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'
|
||||
@@ -648,6 +649,15 @@ 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"
|
||||
|
||||
Reference in New Issue
Block a user