Spaces:
Sleeping
Sleeping
Update app.py
Browse filesRemove bugs from custome_image_processing function
app.py
CHANGED
@@ -7,15 +7,13 @@ import gradio as gr
|
|
7 |
from keras.models import load_model
|
8 |
|
9 |
def custom_Image_preprocessing(image_data, target_size=(150, 150)):
|
10 |
-
img =
|
11 |
-
img = img.resize(target_size)
|
12 |
-
img_arr =
|
13 |
-
|
14 |
-
img_arr = np.stack((img_arr,) * 3, axis=-1)
|
15 |
img_arr = np.expand_dims(img_arr, axis=0)
|
16 |
return img_arr
|
17 |
|
18 |
-
|
19 |
# function to predict the custome image
|
20 |
|
21 |
def image_predict(image_path):
|
|
|
7 |
from keras.models import load_model
|
8 |
|
9 |
def custom_Image_preprocessing(image_data, target_size=(150, 150)):
|
10 |
+
img = image.array_to_img(image_data, data_format='channels_last')
|
11 |
+
img = img.resize(target_size) # Resize the image if needed
|
12 |
+
img_arr = image.img_to_array(img)
|
13 |
+
img_arr = img_arr * 1./255
|
|
|
14 |
img_arr = np.expand_dims(img_arr, axis=0)
|
15 |
return img_arr
|
16 |
|
|
|
17 |
# function to predict the custome image
|
18 |
|
19 |
def image_predict(image_path):
|