frgfm commited on
Commit
1ee6507
1 Parent(s): 2a25d14

fix: Fixed builder script

Browse files
Files changed (1) hide show
  1. openfire.py +9 -6
openfire.py CHANGED
@@ -66,20 +66,23 @@ class OpenFire(datasets.GeneratorBasedBuilder):
66
  name=datasets.Split.TRAIN,
67
  gen_kwargs={
68
  "annot_file": data_dir["train"],
 
69
  },
70
  ),
71
  datasets.SplitGenerator(
72
  name=datasets.Split.VALIDATION,
73
  gen_kwargs={
74
  "annot_file": data_dir["validation"],
 
75
  },
76
  ),
77
  ]
78
 
79
- def _generate_examples(self, annot_file):
80
- with open(annot_file, "rb") as f:
81
  urls = json.load(f)
82
- for label in range(2):
83
- for url in urls[str(label)]:
84
- yield idx, {"image_url": url, "is_wildfire": bool(label)}
85
- idx += 1
 
 
66
  name=datasets.Split.TRAIN,
67
  gen_kwargs={
68
  "annot_file": data_dir["train"],
69
+ "split": "train",
70
  },
71
  ),
72
  datasets.SplitGenerator(
73
  name=datasets.Split.VALIDATION,
74
  gen_kwargs={
75
  "annot_file": data_dir["validation"],
76
+ "split": "validation",
77
  },
78
  ),
79
  ]
80
 
81
+ def _generate_examples(self, filepath, split):
82
+ with open(filepath, "rb", encoding="utf-8") as f:
83
  urls = json.load(f)
84
+ idx = 0
85
+ for label in range(2):
86
+ for url in urls[str(label)]:
87
+ yield idx, {"image_url": url, "is_wildfire": bool(label)}
88
+ idx += 1