KaburaJ commited on
Commit
12f18a9
·
1 Parent(s): b77c7ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -72,10 +72,12 @@ def image_transformation(image):
72
  #image = Image._resize_dispatcher(image, new_shape=(256, 256))
73
  #image= np.resize((256,256))
74
  image = np.array(image)
 
 
75
  np.save('images.npy', image)
76
  image = np.load('images.npy', allow_pickle=True)
77
 
78
- return image
79
 
80
 
81
  # def image_prediction(image, model):
@@ -105,7 +107,6 @@ def main():
105
  # labels = ohe.fit_transform(label).toarray()
106
 
107
  if pred_button:
108
-
109
  outputs = model.predict(image_pred)
110
  #_, y_hat = outputs.max(1)
111
  # predicted_idx = str(y_hat.item())
 
72
  #image = Image._resize_dispatcher(image, new_shape=(256, 256))
73
  #image= np.resize((256,256))
74
  image = np.array(image)
75
+ img_batch = np.expand_dims(image, axis=0)
76
+ img_preprocessed = preprocess_input(img_batch)
77
  np.save('images.npy', image)
78
  image = np.load('images.npy', allow_pickle=True)
79
 
80
+ return image_preprocessed
81
 
82
 
83
  # def image_prediction(image, model):
 
107
  # labels = ohe.fit_transform(label).toarray()
108
 
109
  if pred_button:
 
110
  outputs = model.predict(image_pred)
111
  #_, y_hat = outputs.max(1)
112
  # predicted_idx = str(y_hat.item())