KaburaJ commited on
Commit
fa67a36
·
1 Parent(s): 5dd794e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -73,12 +73,10 @@ def image_transformation(image):
73
  #image = Image._resize_dispatcher(image, new_shape=(256, 256))
74
  #image= np.resize((256,256))
75
  image = np.array(image)
76
- img_batch = np.expand_dims(image, axis=0)
77
- img_preprocessed = preprocess_input(img_batch)
78
  np.save('images.npy', image)
79
  image = np.load('images.npy', allow_pickle=True)
80
 
81
- return image_preprocessed
82
 
83
 
84
  # def image_prediction(image, model):
@@ -108,11 +106,11 @@ def main():
108
  # labels = ohe.fit_transform(label).toarray()
109
 
110
  if pred_button:
111
- outputs = model.predict(image_pred)
112
- #_, y_hat = outputs.max(1)
113
- # predicted_idx = str(y_hat.item())
114
- # right_column.title("Prediction")
115
- # right_column.write(predicted_idx)
116
  right_column.write(decode_predictions(outputs, top=2)[0])
117
 
118
 
 
73
  #image = Image._resize_dispatcher(image, new_shape=(256, 256))
74
  #image= np.resize((256,256))
75
  image = np.array(image)
 
 
76
  np.save('images.npy', image)
77
  image = np.load('images.npy', allow_pickle=True)
78
 
79
+ return image
80
 
81
 
82
  # def image_prediction(image, model):
 
106
  # labels = ohe.fit_transform(label).toarray()
107
 
108
  if pred_button:
109
+ outputs = model.predict(int(image_pred))
110
+ _, y_hat = outputs.max(1)
111
+ predicted_idx = str(y_hat.item())
112
+ right_column.title("Prediction")
113
+ right_column.write(predicted_idx)
114
  right_column.write(decode_predictions(outputs, top=2)[0])
115
 
116