Skip to content

Commit 759d40e

Browse files
author
Val Brodsky
committed
Fix logic for deriving data types for annotations
1 parent 20949f4 commit 759d40e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

libs/labelbox/src/labelbox/data/serialization/ndjson/label.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,11 @@ def _infer_media_type(
156156
raise ValueError("Missing annotations while inferring media type")
157157

158158
types = {type(annotation) for annotation in annotations}
159+
types_values = {type(annotation.value) for annotation in annotations}
159160
data = ImageData
160-
if (TextEntity in types) or (ConversationEntity in types):
161+
if (ObjectAnnotation
162+
in types) and ((TextEntity in types_values) or
163+
(ConversationEntity in types_values)):
161164
data = TextData
162165
elif VideoClassificationAnnotation in types or VideoObjectAnnotation in types:
163166
data = VideoData

libs/labelbox/src/labelbox/schema/internal/data_row_upsert_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from labelbox.schema.data_row import DataRow
88

99

10-
class DataRowItemBase(ABC, pydantic_compat.BaseModel):
10+
class DataRowItemBase(ABC, BaseModel):
1111
"""
1212
Base class for creating payloads for upsert operations.
1313
"""

0 commit comments

Comments
 (0)