storesource commited on
Commit
acd55f1
·
verified ·
1 Parent(s): c9b57d6

Update dataset_viewer_script.py

Browse files
Files changed (1) hide show
  1. dataset_viewer_script.py +32 -51
dataset_viewer_script.py CHANGED
@@ -2,70 +2,51 @@
2
  # Lint as: python3
3
  """Indus Valley Script Character List :: compiled by Iravatham Mahadevan, published by Archaeological Survey of India :: targz dataset."""
4
 
5
-
6
- import json
7
-
8
  import datasets
9
- from datasets.tasks import QuestionAnsweringExtractive
10
-
11
 
12
- logger = datasets.logging.get_logger(__name__)
13
-
14
-
15
- # _CITATION = """
16
- # author = "Iravatham Mahadevan",
17
- # title = "The Indus Scripts: Texts, Concordance and Tables",
18
- # year = 1977
19
- # publisher = "Archaeological Survey of India"
20
- # }
21
- # """
22
 
23
- _DESCRIPTION = """\
24
- IM 417
 
 
 
 
25
  """
 
26
 
27
- _URL = "https://huggingface.co/datasets/tomeheya/IM-417-128/blob/main/IM-417-128x128.tar.gz"
28
 
 
29
 
30
- class ImageDatasetGenerator(datasets.GeneratorBasedBuilder):
 
31
 
32
  def _info(self):
33
- return datasets.DatasetInfo(
 
 
 
 
 
 
 
 
 
34
  description=_DESCRIPTION,
35
- features=datasets.Features(
36
  {
37
- "text": datasets.Value("string"),
38
- "image": datasets.Image()
39
  }
40
  ),
41
- # No default supervised_keys (as we have to pass both question
42
- # and context as input).
43
  supervised_keys=None,
44
- homepage="https://huggingface.co/tomeheya",
45
  citation=_CITATION,
46
- task_templates=[
47
- QuestionAnsweringExtractive(
48
- question_column="question", context_column="context", answers_column="answers"
49
- )
50
- ],
51
  )
52
-
53
- def _split_generators(self, dl_manager):
54
- path = dl_manager.download_and_extract(_URL)
55
- image_iterable = dl_manager.iter_archive(path)
56
-
57
- return [
58
- datasets.SplitGenerator(
59
- name=datasets.Split.TRAIN,
60
- gen_kwargs={"images": image_iterable}),
61
- ]
62
-
63
- def _generate_examples(self, images):
64
- for file_path, image in images:
65
- # Extracting label from file path
66
- label = file_path.split("/")[-2] # Assuming the label is the second last part of the path
67
- yield idx, {
68
- "image": {"path": file_path, "bytes": image.read()},
69
- "label": label
70
- }
71
- idx += 1
 
2
  # Lint as: python3
3
  """Indus Valley Script Character List :: compiled by Iravatham Mahadevan, published by Archaeological Survey of India :: targz dataset."""
4
 
 
 
 
5
  import datasets
 
 
6
 
7
+ _CITATION = """\
8
+ @InProceedings{huggingface:dataset,
9
+ title = {IM-417 128x128 Indus Script Dataset},
10
+ author={storesource},
11
+ year={2024}
12
+ }
13
+ """
 
 
 
14
 
15
+ _DESCRIPTION = """
16
+ IM-417 128x128 Indus Script Dataset.
17
+ Labels derived from Pages 32-34
18
+ From "The Indus Scripts: Texts, Concordance and Tables"
19
+ Compiled by Iravatham Mahadevan,
20
+ Published by Archaeological Survey of India (1977)
21
  """
22
+ _HOMEPAGE = "https://huggingface.co/datasets/tomeheya/IM-417-128"
23
 
24
+ _LICENSE = ""
25
 
26
+ _REPO = "https://huggingface.co/datasets/tomeheya/IM-417-128"
27
 
28
+ class ImageSet(datasets.GeneratorBasedBuilder):
29
+ """Small sample of image-text pairs"""
30
 
31
  def _info(self):
32
+ def extract_features(example):
33
+ text = example["__key__"]
34
+ image = example["png"]
35
+ return {
36
+ "text": text,
37
+ "image": image,
38
+ }
39
+
40
+ dataset = dataset.map(extract_features)
41
+ dataset_info = DatasetInfo(
42
  description=_DESCRIPTION,
43
+ features=Dataset.features(
44
  {
45
+ "sign_label": Value("string"),
46
+ "image": Image(),
47
  }
48
  ),
 
 
49
  supervised_keys=None,
50
+ homepage=_HOMEPAGE,
51
  citation=_CITATION,
 
 
 
 
 
52
  )