Skip to content
Snippets Groups Projects

Use MLClass when using the CreateClassifications helper

Merged Yoann Schneider requested to merge use-ml-class-create-classifs into master
All threads resolved!
2 files
+ 63
29
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -4,6 +4,7 @@ ElementsWorker methods for classifications and ML classes.
"""
from typing import Dict, List, Optional, Union
from uuid import UUID
from apistar.exceptions import ErrorResponse
from peewee import IntegrityError
@@ -173,7+174,7 @@
return
# Propagate any other API error
raise
self.report.add_classification(element.id, ml_class)
@@ -209,7+210,7 @@
ml_class_id, str
), f"Classification at index {index} in classifications: ml_class_id shouldn't be null and should be of type str"
# Make sure it's a valid UUID
try:
UUID(ml_class_id)
except ValueError:
raise ValueError(
f"Classification at index {index} in classifications: ml_class_id is not a valid uuid."
)
confidence = classification.get("confidence")
assert (
confidence is not None
Loading