rshrott commited on
Commit
9c4c1ff
1 Parent(s): 8aaa997

Update renovation.py

Browse files
Files changed (1) hide show
  1. renovation.py +5 -5
renovation.py CHANGED
@@ -3,7 +3,8 @@ import random
3
  import datasets
4
  import requests
5
  import os
6
- import py7zr # for extracting .7z files
 
7
 
8
  from PIL import Image
9
  from io import BytesIO
@@ -96,11 +97,9 @@ class RenovationQualityDataset(datasets.GeneratorBasedBuilder):
96
 
97
  def _generate_examples(self, rows):
98
  def file_to_image(file_path):
99
- def file_to_image(file_path):
100
- img = Image.open(file_path)
101
- return numpy.array(img)
102
 
103
-
104
  for id_, (image_file_path, label) in enumerate(rows):
105
  image = file_to_image(image_file_path)
106
  yield id_, {
@@ -108,3 +107,4 @@ class RenovationQualityDataset(datasets.GeneratorBasedBuilder):
108
  'image': image,
109
  'labels': label,
110
  }
 
 
3
  import datasets
4
  import requests
5
  import os
6
+ import py7zr
7
+ import numpy as np
8
 
9
  from PIL import Image
10
  from io import BytesIO
 
97
 
98
  def _generate_examples(self, rows):
99
  def file_to_image(file_path):
100
+ img = Image.open(file_path)
101
+ return np.array(img)
 
102
 
 
103
  for id_, (image_file_path, label) in enumerate(rows):
104
  image = file_to_image(image_file_path)
105
  yield id_, {
 
107
  'image': image,
108
  'labels': label,
109
  }
110
+