Datasets:
Tasks:
Image Segmentation
Sub-tasks:
semantic-segmentation
Languages:
English
Size:
1K<n<10K
License:
Srushti Hirve
commited on
Commit
·
157df53
1
Parent(s):
a8ce9b7
Fix dataset structure and paths
Browse files
demo.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
import os
|
2 |
import datasets
|
|
|
3 |
|
4 |
class Demo(datasets.GeneratorBasedBuilder):
|
5 |
def _info(self):
|
@@ -8,30 +8,27 @@ class Demo(datasets.GeneratorBasedBuilder):
|
|
8 |
"id": datasets.Value("string"),
|
9 |
"problem": datasets.Value("string"),
|
10 |
"solution": datasets.Value("string"),
|
11 |
-
"image": datasets.Image(),
|
12 |
"img_height": datasets.Value("int32"),
|
13 |
}),
|
14 |
)
|
15 |
|
16 |
def _split_generators(self, dl_manager):
|
17 |
-
# Access the file directly from the root of the repo
|
18 |
-
parquet_path = "visionreasoner_dataset.parquet"
|
19 |
return [
|
20 |
datasets.SplitGenerator(
|
21 |
name=datasets.Split.TRAIN,
|
22 |
-
gen_kwargs={"filepath":
|
23 |
),
|
24 |
]
|
25 |
|
26 |
def _generate_examples(self, filepath):
|
27 |
import pandas as pd
|
28 |
-
|
29 |
df = pd.read_parquet(filepath)
|
30 |
for idx, row in df.iterrows():
|
31 |
yield idx, {
|
32 |
"id": row["id"],
|
33 |
"problem": row["problem"],
|
34 |
"solution": row["solution"],
|
35 |
-
"image": row["image"]["path"], #
|
36 |
"img_height": row["img_height"],
|
37 |
}
|
|
|
|
|
1 |
import datasets
|
2 |
+
import os
|
3 |
|
4 |
class Demo(datasets.GeneratorBasedBuilder):
|
5 |
def _info(self):
|
|
|
8 |
"id": datasets.Value("string"),
|
9 |
"problem": datasets.Value("string"),
|
10 |
"solution": datasets.Value("string"),
|
11 |
+
"image": datasets.Image(),
|
12 |
"img_height": datasets.Value("int32"),
|
13 |
}),
|
14 |
)
|
15 |
|
16 |
def _split_generators(self, dl_manager):
|
|
|
|
|
17 |
return [
|
18 |
datasets.SplitGenerator(
|
19 |
name=datasets.Split.TRAIN,
|
20 |
+
gen_kwargs={"filepath": "visionreasoner_dataset.parquet"},
|
21 |
),
|
22 |
]
|
23 |
|
24 |
def _generate_examples(self, filepath):
|
25 |
import pandas as pd
|
|
|
26 |
df = pd.read_parquet(filepath)
|
27 |
for idx, row in df.iterrows():
|
28 |
yield idx, {
|
29 |
"id": row["id"],
|
30 |
"problem": row["problem"],
|
31 |
"solution": row["solution"],
|
32 |
+
"image": row["image"]["path"], # e.g., images/ui_img_10.webp
|
33 |
"img_height": row["img_height"],
|
34 |
}
|