Update app.py
Browse files
app.py
CHANGED
@@ -13,18 +13,18 @@ model = tf.keras.models.load_model(path_to_model)
|
|
13 |
IMG_HEIGHT = 180
|
14 |
IMG_WIDTH = 180
|
15 |
|
|
|
16 |
# Define a function to preprocess the image
|
17 |
def preprocess_image(image):
|
18 |
# Resize the image to the expected input size of the model
|
19 |
img = image.resize((IMG_HEIGHT, IMG_WIDTH))
|
20 |
-
#
|
21 |
-
img_array =
|
22 |
# Normalize the pixel values
|
23 |
img_array = img_array / 255.0
|
24 |
-
# Reshape the image array to match the input shape of the model
|
25 |
-
img_array = np.reshape(img_array, (1, IMG_HEIGHT, IMG_WIDTH, 3))
|
26 |
return img_array
|
27 |
|
|
|
28 |
# Create the Streamlit app
|
29 |
def main():
|
30 |
# Set the title and a brief description
|
|
|
13 |
IMG_HEIGHT = 180
|
14 |
IMG_WIDTH = 180
|
15 |
|
16 |
+
# Define a function to preprocess the image
|
17 |
# Define a function to preprocess the image
|
18 |
def preprocess_image(image):
|
19 |
# Resize the image to the expected input size of the model
|
20 |
img = image.resize((IMG_HEIGHT, IMG_WIDTH))
|
21 |
+
# Reshape the image array to match the input shape of the model
|
22 |
+
img_array = np.array(img).reshape((1, IMG_HEIGHT, IMG_WIDTH, 3))
|
23 |
# Normalize the pixel values
|
24 |
img_array = img_array / 255.0
|
|
|
|
|
25 |
return img_array
|
26 |
|
27 |
+
|
28 |
# Create the Streamlit app
|
29 |
def main():
|
30 |
# Set the title and a brief description
|