Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras.models import load_model
|
4 |
-
from tensorflow.keras.preprocessing.image import img_to_array
|
5 |
import numpy as np
|
6 |
import os
|
7 |
|
@@ -20,7 +20,7 @@ model_path = r"inceptionv3_class.h5"
|
|
20 |
hierarchical_models['class'] = load_model(model_path)
|
21 |
|
22 |
def load_and_preprocess_image(image, target_size=(224, 224)):
|
23 |
-
image =
|
24 |
img_array = img_to_array(image)
|
25 |
img_array = np.expand_dims(img_array, axis=0)
|
26 |
img_array = tf.keras.applications.mobilenet_v2.preprocess_input(img_array)
|
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras.models import load_model
|
4 |
+
from tensorflow.keras.preprocessing.image import img_to_array,load_img
|
5 |
import numpy as np
|
6 |
import os
|
7 |
|
|
|
20 |
hierarchical_models['class'] = load_model(model_path)
|
21 |
|
22 |
def load_and_preprocess_image(image, target_size=(224, 224)):
|
23 |
+
image = load_img(img_path, target_size=(224, 224))
|
24 |
img_array = img_to_array(image)
|
25 |
img_array = np.expand_dims(img_array, axis=0)
|
26 |
img_array = tf.keras.applications.mobilenet_v2.preprocess_input(img_array)
|