File size: 1,317 Bytes
2e48b5a 04f66c7 2e48b5a 04f66c7 2e48b5a 04f66c7 2e48b5a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | import json
import datasets
class ClipCc(datasets.GeneratorBasedBuilder):
VERSION = datasets.Version("1.0.0")
def _info(self):
return datasets.DatasetInfo(
description="A dataset of 200 video summaries with corresponding YouTube links and IDs.",
features=datasets.Features(
{
"id": datasets.Value("string"),
"file_link": datasets.Value("string"),
"summary": datasets.Value("string"),
}
),
supervised_keys=None,
homepage="https://huggingface.co/datasets/IVSL-SDSU/Clip-CC",
license="apache-2.0"
)
def _split_generators(self, dl_manager):
data_path = dl_manager.download_and_extract("metadata.jsonl")
return [
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_path})
]
def _generate_examples(self, filepath):
with open(filepath, encoding="utf-8") as f:
for idx, line in enumerate(f):
item = json.loads(line)
yield idx, {
"id": item.get("id", ""),
"file_link": item.get("file_link", ""),
"summary": item.get("summary", ""),
}
|