ChuckNorris
commited on
Commit
·
6371523
1
Parent(s):
70ce0df
Initial commit
Browse files- src/tools.py +4 -2
src/tools.py
CHANGED
@@ -163,10 +163,12 @@ def get_image_by_sku(sku: str or int) -> np.array:
|
|
163 |
try:
|
164 |
image_name = image_data[image_data['sku'] == str(sku)]['image'].iloc[0]
|
165 |
with Image.open(f'data/images/{dir}/{image_name}') as img:
|
166 |
-
|
|
|
167 |
except:
|
168 |
if num == 2:
|
169 |
raise Exception
|
170 |
except:
|
171 |
with Image.open('data/service_images/' + 'no_img.jpg') as img:
|
172 |
-
|
|
|
|
163 |
try:
|
164 |
image_name = image_data[image_data['sku'] == str(sku)]['image'].iloc[0]
|
165 |
with Image.open(f'data/images/{dir}/{image_name}') as img:
|
166 |
+
res = np.array(img)
|
167 |
+
return res
|
168 |
except:
|
169 |
if num == 2:
|
170 |
raise Exception
|
171 |
except:
|
172 |
with Image.open('data/service_images/' + 'no_img.jpg') as img:
|
173 |
+
res = np.array(img)
|
174 |
+
return res
|