@@ -17,42 +17,14 @@ class AudioClassificationAnnotation(ClassificationAnnotation):
1717 feature_schema_id (Optional[Cuid]): Feature schema identifier
1818 value (Union[Text, Checklist, Radio]): Classification value
1919 frame (int): The frame index in milliseconds (e.g., 2500 = 2.5 seconds)
20+ end_frame (Optional[int]): End frame in milliseconds (for time ranges)
2021 segment_index (Optional[int]): Index of audio segment this annotation belongs to
2122 extra (Dict[str, Any]): Additional metadata
2223 """
2324
2425 frame : int
26+ end_frame : Optional [int ] = None
2527 segment_index : Optional [int ] = None
26-
27- @classmethod
28- def from_time_range (cls , start_ms : int , end_ms : int , ** kwargs ):
29- """Create from milliseconds (user-friendly) to frames (internal)
30-
31- Args:
32- start_ms (int): Start time in milliseconds
33- end_ms (int): End time in milliseconds
34- **kwargs: Additional arguments for the annotation
35-
36- Returns:
37- AudioClassificationAnnotation: Annotation with frame set to start_ms
38-
39- Example:
40- >>> AudioClassificationAnnotation.from_time_range(
41- ... start_ms=2500, end_ms=4100,
42- ... name="speaker_id",
43- ... value=lb_types.Radio(answer=lb_types.ClassificationAnswer(name="john"))
44- ... )
45- """
46- return cls (frame = start_ms , ** kwargs )
47-
48- @property
49- def start_time (self ) -> float :
50- """Convert frame to seconds for user-facing APIs
51-
52- Returns:
53- float: Time in seconds (e.g., 2500 -> 2.5)
54- """
55- return self .frame / 1000.0
5628
5729
5830class AudioObjectAnnotation (ObjectAnnotation , ConfidenceNotSupportedMixin , CustomMetricsNotSupportedMixin ):
@@ -68,42 +40,14 @@ class AudioObjectAnnotation(ObjectAnnotation, ConfidenceNotSupportedMixin, Custo
6840 feature_schema_id (Optional[Cuid]): Feature schema identifier
6941 value (Union[TextEntity, Geometry]): Localization or text content
7042 frame (int): The frame index in milliseconds (e.g., 10000 = 10.0 seconds)
43+ end_frame (Optional[int]): End frame in milliseconds (for time ranges)
7144 keyframe (bool): Whether this is a keyframe annotation (default: True)
7245 segment_index (Optional[int]): Index of audio segment this annotation belongs to
7346 classifications (Optional[List[ClassificationAnnotation]]): Optional sub-classifications
7447 extra (Dict[str, Any]): Additional metadata
7548 """
7649
7750 frame : int
51+ end_frame : Optional [int ] = None
7852 keyframe : bool = True
7953 segment_index : Optional [int ] = None
80-
81- @classmethod
82- def from_time_range (cls , start_ms : int , end_ms : int , ** kwargs ):
83- """Create from milliseconds (user-friendly) to frames (internal)
84-
85- Args:
86- start_ms (int): Start time in milliseconds
87- end_ms (int): End time in milliseconds
88- **kwargs: Additional arguments for the annotation
89-
90- Returns:
91- AudioObjectAnnotation: Annotation with frame set to start_ms
92-
93- Example:
94- >>> AudioObjectAnnotation.from_time_range(
95- ... start_ms=10000, end_ms=12500,
96- ... name="transcription",
97- ... value=lb_types.TextEntity(text="Hello world")
98- ... )
99- """
100- return cls (frame = start_ms , ** kwargs )
101-
102- @property
103- def start_time (self ) -> float :
104- """Convert frame to seconds for user-facing APIs
105-
106- Returns:
107- float: Time in seconds (e.g., 10000 -> 10.0)
108- """
109- return self .frame / 1000.0
0 commit comments