tahamajs's picture
download
raw
714 Bytes
"""Celery tasks for the Lab Assistant."""
from celery import shared_task
from .ai_assistant import AIAssistant
@shared_task
def auto_pre_label_new_tasks(project_id: str):
"""Automatically run AI pre-labeling on newly imported tasks."""
from .models import AnnotationProject
try:
project = AnnotationProject.objects.get(id=project_id)
except AnnotationProject.DoesNotExist:
return
if not project.ai_model_id:
return
assistant = AIAssistant(model_id=project.ai_model_id)
tasks = project.tasks.filter(status="pending", ai_predictions=[])
count = 0
for task in tasks:
if assistant.pre_label_task(task):
count += 1
return count

Xet Storage Details

Size:
714 Bytes
·
Xet hash:
50917f8f8c6cff378efe3fc76eb1234401f4248069c4059caadf151e82d2ea84

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.