Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ImenBizid authored May 26, 2021
1 parent c2441c5 commit b163189
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions maas_dl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import sys
import time
import os
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
#from keras.preprocessing.image import load_img
#from keras.preprocessing.image import img_to_array

INSTANCE_PATH = os.getenv('INSTANCE_PATH') if os.getenv('INSTANCE_PATH') is not None else "/model_as_service"
CONFIG_FILE_BIN = os.path.join(INSTANCE_PATH,"config_file.bin")
Expand Down Expand Up @@ -205,16 +205,16 @@ def get_newest_deployed_version(model_name) -> int:
return max

# load and prepare the image
def load_image(filename):
#def load_image(filename):
# load the image
img = load_img(filename, color_mode="grayscale", target_size=(28, 28))
# img = load_img(filename, color_mode="grayscale", target_size=(28, 28))
# convert to array
img = img_to_array(img)
print("img")
# img = img_to_array(img)
# print("img")
# reshape into a single sample with 1 channel
img = img.reshape(1, 28, 28, 1)
# img = img.reshape(1, 28, 28, 1)
# prepare pixel data
img = img.astype('float32')
img = img / 255.0
# img = img.astype('float32')
# img = img / 255.0
#print ("img :", img)
return img
# return img

0 comments on commit b163189

Please sign in to comment.