Datasets:
add bytes
Browse files
TGIF.py
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import csv
|
5 |
import datasets
|
6 |
import os
|
|
|
7 |
|
8 |
_CITATION = """
|
9 |
@InProceedings{tgif-cvpr2016,
|
@@ -48,8 +49,9 @@ class TGIF(datasets.GeneratorBasedBuilder):
|
|
48 |
description=_DESCRIPTION,
|
49 |
features=datasets.Features(
|
50 |
{
|
51 |
-
"
|
52 |
-
"
|
|
|
53 |
}
|
54 |
),
|
55 |
supervised_keys=None,
|
@@ -109,7 +111,10 @@ class TGIF(datasets.GeneratorBasedBuilder):
|
|
109 |
except Exception:
|
110 |
pass
|
111 |
for idx, video_link in enumerate(dict):
|
|
|
|
|
112 |
yield idx, {
|
113 |
-
"
|
114 |
-
"
|
|
|
115 |
}
|
|
|
4 |
import csv
|
5 |
import datasets
|
6 |
import os
|
7 |
+
import urllib.request
|
8 |
|
9 |
_CITATION = """
|
10 |
@InProceedings{tgif-cvpr2016,
|
|
|
49 |
description=_DESCRIPTION,
|
50 |
features=datasets.Features(
|
51 |
{
|
52 |
+
"video_path": datasets.Value("string"),
|
53 |
+
"video_bytes": datasets.Value("large_binary"),
|
54 |
+
"en_captions": datasets.features.Sequence(datasets.Value("string"))
|
55 |
}
|
56 |
),
|
57 |
supervised_keys=None,
|
|
|
111 |
except Exception:
|
112 |
pass
|
113 |
for idx, video_link in enumerate(dict):
|
114 |
+
video_data = urllib.request.urlopen(video_link).read()
|
115 |
+
video_bytes = bytearray(video_data)
|
116 |
yield idx, {
|
117 |
+
"video_path": video_link,
|
118 |
+
"video_bytes": video_bytes,
|
119 |
+
"en_captions": dict[video_link],
|
120 |
}
|