subhuatharva commited on
Commit
3fcbb33
1 Parent(s): 218797d

Delete data_loader.py

Browse files
Files changed (1) hide show
  1. data_loader.py +0 -52
data_loader.py DELETED
@@ -1,52 +0,0 @@
1
- import json
2
- import datasets
3
- import pandas as pd
4
-
5
- logger = datasets.logging.get_logger(__name__)
6
-
7
- labels = pd.read_csv('/Users/Atharv/All scripts/Project/Multi label classification/train_classes.csv')
8
-
9
- _URL = "https://huggingface.co/datasets/subhuatharva/amazon_from_space/resolve/main/train-jpg.tar.gz?download=true"
10
-
11
-
12
- class amazon_from_space(datasets.GeneratorBasedBuilder):
13
- """Planet Dataset: Understanding Amazon Rainforest from Space"""
14
-
15
- def _info(self):
16
- return datasets.DatasetInfo(
17
- description = _DESCRIPTION,
18
- features = datasets.Features(
19
- {
20
- "image": datasets.Image(),
21
- "labels": datasets.Value("string"),
22
- }
23
- ),
24
- supervised_keys = None,
25
- homepage = "https://huggingface.co/datasets/subhuatharva/amazon_from_space",
26
- )
27
-
28
- def _split_generators(self, dl_manager):
29
- path = dl_manager.download_and_extract(_URL)
30
- image_iters = dl_manager.iter_archive(path)
31
-
32
- return [
33
- datasets.SplitGenerator(
34
- name = datasets.Split.TRAIN,
35
- gen_kwargs = {
36
- "images": image_iters
37
- }
38
- ),
39
- ]
40
- def _generate_examples(self, images):
41
- """This function returns the examples in the raw (text) form."""
42
-
43
- idx = 0
44
-
45
- # iterate through images
46
- for filepath, image in images:
47
- yield idx, {
48
- "image": {"filepath": filepath, "image": image.read()},
49
- "text": labels['tags'][idx],
50
- }
51
-
52
- idx+=1