Datasets:
Update Spatial457.py
Browse files- Spatial457.py +12 -3
Spatial457.py
CHANGED
|
@@ -36,10 +36,19 @@ class Spatial457(datasets.GeneratorBasedBuilder):
|
|
| 36 |
)
|
| 37 |
|
| 38 |
def _split_generators(self, dl_manager):
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
return [
|
| 45 |
datasets.SplitGenerator(
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
def _split_generators(self, dl_manager):
|
| 39 |
+
|
| 40 |
+
base_url = "https://huggingface.co/datasets/RyanWW/Spatial457/resolve/main"
|
| 41 |
+
|
| 42 |
+
json_url = f"{base_url}/questions/{self.config.name}.json"
|
| 43 |
+
image_url_template = f"{base_url}/images"
|
| 44 |
+
# 下载 json 文件
|
| 45 |
+
task_json = dl_manager.download(json_url)
|
| 46 |
+
# 下载整个 images 目录(如果太大,也可以改成逐张下载或改为 tar 包)
|
| 47 |
+
image_dir = dl_manager.download_and_extract(image_url_template)
|
| 48 |
|
| 49 |
+
# data_dir = dl_manager.manual_dir # expects local `images/` and `questions/`
|
| 50 |
+
# task_json = os.path.join(data_dir, "questions", f"{self.config.name}.json")
|
| 51 |
+
# image_dir = os.path.join(data_dir, "images")
|
| 52 |
|
| 53 |
return [
|
| 54 |
datasets.SplitGenerator(
|