Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
| 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 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 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 |
|