Yellow labels, and injected error for new spawned tasks.
parent
81be54b5f7
commit
428692f6c8
|
|
@ -1,7 +1,7 @@
|
||||||
#+title: Script
|
#+title: Script
|
||||||
#+author: Sébastien Miquel
|
#+author: Sébastien Miquel
|
||||||
#+date: 14-03-2026
|
#+date: 14-03-2026
|
||||||
# Time-stamp: <01-05-26 22:35>
|
# Time-stamp: <02-05-26 13:44>
|
||||||
#+OPTIONS:
|
#+OPTIONS:
|
||||||
|
|
||||||
* Quézaco
|
* Quézaco
|
||||||
|
|
@ -252,8 +252,8 @@ groupée into refaire !!
|
||||||
+ =python plotting.py InterroTest/Copie01.pdf=
|
+ =python plotting.py InterroTest/Copie01.pdf=
|
||||||
+ =python splitting_int.py InterroTest/Copie20.pdf=
|
+ =python splitting_int.py InterroTest/Copie20.pdf=
|
||||||
2. Créer =refaire.json=, avec un contenu comme
|
2. Créer =refaire.json=, avec un contenu comme
|
||||||
[["Copie01", []],
|
: [["Copie01", []],
|
||||||
["Copie01", ["Ex 1 : 1)"]]]
|
: ["Copie01", ["Ex 1 : 1)"]]]
|
||||||
3. Appeler =correction= avec --refaire. Il doit créer des groupes
|
3. Appeler =correction= avec --refaire. Il doit créer des groupes
|
||||||
individuels, faire des requêtes, et remplacer les corrections
|
individuels, faire des requêtes, et remplacer les corrections
|
||||||
précédentes (à sauver ailleurs).
|
précédentes (à sauver ailleurs).
|
||||||
|
|
|
||||||
|
|
@ -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))
|
height = grouping.get_pdf_height(str(new_pdf_path))
|
||||||
grouping.create_jpg(add_label, idx, [(pid, str(new_pdf_path), height)], INPUT_DIR)
|
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"),
|
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}"
|
error += f"(->){add_label}"
|
||||||
keep_error = True
|
keep_error = True
|
||||||
else:
|
else:
|
||||||
|
|
@ -603,6 +603,7 @@ def process_single_task(task_tuple, precomputed_response=None):
|
||||||
file_path = task_tuple[0]
|
file_path = task_tuple[0]
|
||||||
label = task_tuple[1]
|
label = task_tuple[1]
|
||||||
can_spawn_tasks = task_tuple[2] if len(task_tuple) > 2 else True
|
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]
|
group_name = os.path.splitext(file_path)[0]
|
||||||
json_path = group_name + '.json'
|
json_path = group_name + '.json'
|
||||||
|
|
@ -648,6 +649,15 @@ def process_single_task(task_tuple, precomputed_response=None):
|
||||||
for p in json_data:
|
for p in json_data:
|
||||||
pid = p["id"]
|
pid = p["id"]
|
||||||
res = p["result"]
|
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]
|
yming, ymaxg, width_r = d_data[pid]
|
||||||
|
|
||||||
pdf_path = Path(INPUT_DIR) / f"Copie{pid}" / f"{label}.pdf"
|
pdf_path = Path(INPUT_DIR) / f"Copie{pid}" / f"{label}.pdf"
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,8 @@ def prepare_image(image_path: str, bounding_boxes, all_labels, nb_pages, last_la
|
||||||
current_index = all_labels.index(label)
|
current_index = all_labels.index(label)
|
||||||
if current_index < last_label_index or (last_label_index == -1 and current_index != 0):
|
if current_index < last_label_index or (last_label_index == -1 and current_index != 0):
|
||||||
color = "red"
|
color = "red"
|
||||||
|
elif current_index > last_label_index + 1:
|
||||||
|
color = "yellow"
|
||||||
last_label_index = current_index
|
last_label_index = current_index
|
||||||
|
|
||||||
draw.rectangle(((abs_x_min, abs_y_min), (abs_x_max, abs_y_max)), outline=color, width=4)
|
draw.rectangle(((abs_x_min, abs_y_min), (abs_x_max, abs_y_max)), outline=color, width=4)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue