Skip to content

Commit

Permalink
fix(management): add override for wrongly labeled tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Dec 11, 2024
1 parent 33a3091 commit 4f9ecbb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apis_instance_nsvis/management/commands/importannotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
labelstudio_token = os.getenv("LABELSTUDIO_TOKEN", None)


def override(project, attribute):
match project:
case 69:
if attribute == "issue":
return "Wiener Illustrierte vom 23.11.1944"
return None


class Command(BaseCommand):
help = "Import data from LabelStudio Export"

Expand Down Expand Up @@ -42,7 +50,7 @@ def handle(self, *args, **options):
ann_ids.append(annotation.id)
annotation.data = annotations[ann]
annotation.image = task["data"]["image"]
annotation.issue = task["data"]["issue"]
annotation.issue = override(project, "issue") or task["data"]["issue"]
annotation.save()
Annotation.objects.exclude(id__in=ann_ids).delete()
for ann in Annotation.objects.all():
Expand Down

0 comments on commit 4f9ecbb

Please sign in to comment.