Datasets:
Tasks:
Image Segmentation
Sub-tasks:
semantic-segmentation
Languages:
English
Size:
1K<n<10K
License:
Srushti Hirve
commited on
Commit
·
83443a0
1
Parent(s):
078799e
Fix path for parquet file
Browse files
demo.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import os
|
| 2 |
import datasets
|
| 3 |
-
import pandas as pd
|
| 4 |
|
| 5 |
class Demo(datasets.GeneratorBasedBuilder):
|
| 6 |
def _info(self):
|
|
@@ -15,22 +14,24 @@ class Demo(datasets.GeneratorBasedBuilder):
|
|
| 15 |
)
|
| 16 |
|
| 17 |
def _split_generators(self, dl_manager):
|
| 18 |
-
|
| 19 |
-
parquet_path =
|
| 20 |
return [
|
| 21 |
datasets.SplitGenerator(
|
| 22 |
name=datasets.Split.TRAIN,
|
| 23 |
-
gen_kwargs={"filepath": parquet_path
|
| 24 |
),
|
| 25 |
]
|
| 26 |
|
| 27 |
-
def _generate_examples(self, filepath
|
|
|
|
|
|
|
| 28 |
df = pd.read_parquet(filepath)
|
| 29 |
for idx, row in df.iterrows():
|
| 30 |
yield idx, {
|
| 31 |
"id": row["id"],
|
| 32 |
"problem": row["problem"],
|
| 33 |
"solution": row["solution"],
|
| 34 |
-
"image":
|
| 35 |
"img_height": row["img_height"],
|
| 36 |
}
|
|
|
|
| 1 |
import os
|
| 2 |
import datasets
|
|
|
|
| 3 |
|
| 4 |
class Demo(datasets.GeneratorBasedBuilder):
|
| 5 |
def _info(self):
|
|
|
|
| 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": parquet_path}
|
| 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"], # assuming this is already like "images/xyz.webp"
|
| 36 |
"img_height": row["img_height"],
|
| 37 |
}
|