kamalgodar
commited on
Commit
•
67c0935
1
Parent(s):
8a5213c
Delete donut-try.py
Browse files- donut-try.py +0 -56
donut-try.py
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
|
3 |
-
import datasets
|
4 |
-
|
5 |
-
logger = datasets.logging.get_logger(__name__)
|
6 |
-
|
7 |
-
_CITATION = """
|
8 |
-
citation text
|
9 |
-
"""
|
10 |
-
|
11 |
-
_DESCRIPTION = """\
|
12 |
-
Demo...
|
13 |
-
"""
|
14 |
-
|
15 |
-
description = ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20']
|
16 |
-
|
17 |
-
_URL = "https://huggingface.co/datasets/kamalgodar/donut-test/resolve/main/images.tar.gz"
|
18 |
-
|
19 |
-
class DonutTry(datasets.GeneratorBasedBuilder):
|
20 |
-
def _info(self):
|
21 |
-
return datasets.DatasetInfo(
|
22 |
-
description=_DESCRIPTION,
|
23 |
-
features=datasets.Features(
|
24 |
-
{
|
25 |
-
"json": datasets.Value("string"),
|
26 |
-
"image": datasets.Image(),
|
27 |
-
}
|
28 |
-
),
|
29 |
-
supervised_keys=None,
|
30 |
-
homepage="https://huggingface.co/datasets/kamalgodar/donut-test",
|
31 |
-
citation=_CITATION,
|
32 |
-
)
|
33 |
-
|
34 |
-
def _split_generators(self, dl_manager):
|
35 |
-
path = dl_manager.download_and_extract(_URL)
|
36 |
-
image_iters = dl_manager.iter_archive(path)
|
37 |
-
|
38 |
-
return [
|
39 |
-
datasets.SplitGenerator(
|
40 |
-
name=datasets.Split.TRAIN,
|
41 |
-
gen_kwargs={
|
42 |
-
"images": image_iters
|
43 |
-
}
|
44 |
-
),
|
45 |
-
]
|
46 |
-
|
47 |
-
def _generate_examples(self, images):
|
48 |
-
idx = 0
|
49 |
-
|
50 |
-
for filepath, image in images:
|
51 |
-
yield idx, {
|
52 |
-
"image": {"path": filepath, "bytes": image.read()},
|
53 |
-
"json": description[idx],
|
54 |
-
}
|
55 |
-
|
56 |
-
idx += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|