Update soybean_dataset.py
Browse files- soybean_dataset.py +8 -19
soybean_dataset.py
CHANGED
@@ -98,33 +98,22 @@ class SoybeanDataset(datasets.GeneratorBasedBuilder):
|
|
98 |
citation=_CITATION,
|
99 |
)
|
100 |
|
101 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager)
|
102 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
|
103 |
-
# Since the dataset is on Google Drive, you need to implement a way to download it using the Google Drive API.
|
104 |
-
|
105 |
-
# The path to the dataset file in Google Drive
|
106 |
urls_to_download = self._URLs
|
107 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
108 |
-
|
109 |
-
# Since we're using a local file, we don't need to download it, so we just return the path.
|
110 |
return [
|
111 |
datasets.SplitGenerator(
|
112 |
-
name=datasets.Split.TRAIN,
|
|
|
113 |
datasets.SplitGenerator(
|
114 |
-
name=datasets.Split.TEST,
|
|
|
115 |
datasets.SplitGenerator(
|
116 |
-
name=datasets.Split.VALIDATION,
|
|
|
117 |
]
|
118 |
|
119 |
-
# def process_image(self,image_url):
|
120 |
-
# response = requests.get(image_url)
|
121 |
-
# response.raise_for_status() # This will raise an exception if there is a download error
|
122 |
-
|
123 |
-
# # Open the image from the downloaded bytes and return the PIL Image
|
124 |
-
# img = Image.open(BytesIO(response.content))
|
125 |
-
# return img
|
126 |
-
|
127 |
-
|
128 |
|
129 |
def _generate_examples(self, filepath):
|
130 |
logging.info("Generating examples from = %s", filepath)
|
|
|
98 |
citation=_CITATION,
|
99 |
)
|
100 |
|
101 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
|
|
|
|
|
|
|
|
102 |
urls_to_download = self._URLs
|
103 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
104 |
+
|
|
|
105 |
return [
|
106 |
datasets.SplitGenerator(
|
107 |
+
name=datasets.Split.TRAIN,
|
108 |
+
gen_kwargs={"filepath": os.path.join(downloaded_files["train"], 'some_subfolder_if_exists')}),
|
109 |
datasets.SplitGenerator(
|
110 |
+
name=datasets.Split.TEST,
|
111 |
+
gen_kwargs={"filepath": os.path.join(downloaded_files["test"], 'some_subfolder_if_exists')}),
|
112 |
datasets.SplitGenerator(
|
113 |
+
name=datasets.Split.VALIDATION,
|
114 |
+
gen_kwargs={"filepath": os.path.join(downloaded_files["valid"], 'some_subfolder_if_exists')}),
|
115 |
]
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
def _generate_examples(self, filepath):
|
119 |
logging.info("Generating examples from = %s", filepath)
|