Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from PIL import Image
|
|
3 |
import tensorflow as tf
|
4 |
from tensorflow.keras.preprocessing.image import img_to_array
|
5 |
import numpy as np
|
|
|
6 |
|
7 |
path_to_model = "nova.h5"
|
8 |
|
@@ -14,7 +15,7 @@ IMG_WIDTH = 180
|
|
14 |
|
15 |
# Preprocessing
|
16 |
def preprocess_image(image):
|
17 |
-
img =
|
18 |
img_array = img_to_array(img)
|
19 |
img_array = img_array / 255.0
|
20 |
img_array = np.reshape(img_array, (1, IMG_HEIGHT, IMG_WIDTH, 3))
|
|
|
3 |
import tensorflow as tf
|
4 |
from tensorflow.keras.preprocessing.image import img_to_array
|
5 |
import numpy as np
|
6 |
+
import cv2
|
7 |
|
8 |
path_to_model = "nova.h5"
|
9 |
|
|
|
15 |
|
16 |
# Preprocessing
|
17 |
def preprocess_image(image):
|
18 |
+
img = cv2.resize(image, (IMG_HEIGHT, IMG_WIDTH))
|
19 |
img_array = img_to_array(img)
|
20 |
img_array = img_array / 255.0
|
21 |
img_array = np.reshape(img_array, (1, IMG_HEIGHT, IMG_WIDTH, 3))
|