source code Browse git
from typing import Type, Dict, Optional, List, Tuple, Any, Union
from pydantic import BaseModel, confloat


class PredictionValue(BaseModel):
    """ """

    model_version: Optional[Any] = None
    score: Optional[float] = 0.00
    result: Optional[List[Any]] = []
    # cluster: Optional[Any] = None
    # neighbors: Optional[Any] = None

    def serialize(self):
        from label_studio_sdk.label_interface.region import Region

        return {
            "model_version": self.model_version,
            "score": self.score,
            "result": [r._dict() if isinstance(r, Region) else r for r in self.result],
        }


class AnnotationValue(BaseModel):
    """ """

    result: Optional[List[dict]]


class TaskValue(BaseModel):
    """ """

    data: Optional[dict]
    annotations: Optional[List[AnnotationValue]]
    predictions: Optional[List[PredictionValue]]

Classes

class AnnotationValue (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

source code Browse git
class AnnotationValue(BaseModel):
    """ """

    result: Optional[List[dict]]

Constants

model_computed_fields
model_config
model_fields
result : Optional[List[dict]]
class PredictionValue (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

source code Browse git
class PredictionValue(BaseModel):
    """ """

    model_version: Optional[Any] = None
    score: Optional[float] = 0.00
    result: Optional[List[Any]] = []
    # cluster: Optional[Any] = None
    # neighbors: Optional[Any] = None

    def serialize(self):
        from label_studio_sdk.label_interface.region import Region

        return {
            "model_version": self.model_version,
            "score": self.score,
            "result": [r._dict() if isinstance(r, Region) else r for r in self.result],
        }

Constants

model_computed_fields
model_config
model_fields
model_version : Optional[Any]
result : Optional[List[Any]]
score : Optional[float]

Methods

def serialize(self)
source code Browse git
def serialize(self):
    from label_studio_sdk.label_interface.region import Region

    return {
        "model_version": self.model_version,
        "score": self.score,
        "result": [r._dict() if isinstance(r, Region) else r for r in self.result],
    }
class TaskValue (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

source code Browse git
class TaskValue(BaseModel):
    """ """

    data: Optional[dict]
    annotations: Optional[List[AnnotationValue]]
    predictions: Optional[List[PredictionValue]]

Constants

annotations : Optional[List[AnnotationValue]]
data : Optional[dict]
model_computed_fields
model_config
model_fields
predictions : Optional[List[PredictionValue]]