Skip to content

Commit 8f0ae65

Browse files
authored
Include Video features in HF Croissants (#3227)
1 parent 2436c56 commit 8f0ae65

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

libs/libcommon/src/libcommon/croissant_utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from collections.abc import Mapping
66
from typing import Any, Optional, Union
77

8-
from datasets import Audio, ClassLabel, Image, LargeList, List, Value
8+
from datasets import Audio, ClassLabel, Image, LargeList, List, Value, Video
99

1010
NAME_PATTERN_REGEX = "[^a-zA-Z0-9\\-_\\.]"
1111
JSONPATH_PATTERN_REGEX = re.compile(r"^[a-zA-Z0-9_]+$")
@@ -161,6 +161,14 @@ def feature_to_croissant_field(
161161
"dataType": "sc:Integer",
162162
"source": get_source(distribution_name, column, add_transform, json_path),
163163
}
164+
elif isinstance(feature, Video):
165+
source = get_source(distribution_name, column, add_transform, json_path)
166+
return {
167+
"@type": "cr:Field",
168+
"@id": field_name,
169+
"dataType": "sc:VideoObject",
170+
"source": source,
171+
}
164172
# Field with sub-fields.
165173
elif isinstance(feature, dict):
166174
sub_fields = []

0 commit comments

Comments
 (0)