Skip to content

Commit 382123d

Browse files
authored
Add optional install option to Image constructor
1 parent d5f00c6 commit 382123d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

eggdriver/resources/structures/images.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
from colr import color
2+
13
from eggdriver.resources.structures.lists import List
24
from eggdriver.resources.structures.matrices import listMatrix
35
from eggdriver.resources.modules import installFromRequests
46
from eggdriver.resources.console import sleep
57
from eggdriver.resources.constants import limit, square, whiteSquare, blackSquare
68

79
class Image(listMatrix):
8-
def __init__(self, listOfLists = []):
9-
installFromRequests(["numpy", "tensorflow", "keras", "Pillow", "Colr"], False) # Install
10+
def __init__(self, listOfLists = [], auto_install = True):
1011
super().__init__(listOfLists)
1112
self.bias = [0, 0, 0]
13+
14+
if auto_install:
15+
installFromRequests(["numpy", "tensorflow", "keras", "Pillow", "Colr"], False) # Install
16+
1217
def load(self, fileName):
1318
from keras.preprocessing import image # Local import
1419
import numpy as np # Local import
@@ -31,7 +36,6 @@ def loadFromBW(self, vanillaMatrix):
3136
def loadFromRGB(self, vanillaMatrix):
3237
[self.addLast(List(vanillaList)) for vanillaList in vanillaMatrix]
3338
def printRGB(self):
34-
from colr import color # Local import
3539
b = self.bias
3640
for vanillaList in self.matrix:
3741
line = limit
@@ -57,4 +61,4 @@ def colour(self, list, id):
5761
return 0
5862
if result > 255:
5963
return 255
60-
return result
64+
return result

0 commit comments

Comments
 (0)