Spaces:
Runtime error
Runtime error
added a new way to load model
Browse files
app.py
CHANGED
@@ -5,7 +5,20 @@ import tensorflow_hub as hub
|
|
5 |
import cv2
|
6 |
|
7 |
path = '20220804-16551659632113-all-images-Adam.h5'
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
labels = ['affenpinscher', 'afghan_hound', 'african_hunting_dog', 'airedale',
|
11 |
'american_staffordshire_terrier', 'appenzeller',
|
|
|
5 |
import cv2
|
6 |
|
7 |
path = '20220804-16551659632113-all-images-Adam.h5'
|
8 |
+
#aks----------------
|
9 |
+
# for load model
|
10 |
+
# Define custom objects used in the model
|
11 |
+
class CustomLayer(tf.keras.layers.Layer):
|
12 |
+
pass
|
13 |
+
|
14 |
+
# Register custom objects
|
15 |
+
custom_objects = {'KerasLayer': hub.KerasLayer}
|
16 |
+
|
17 |
+
# Load the model with custom objects registered
|
18 |
+
with tf.keras.utils.custom_object_scope(custom_objects):
|
19 |
+
model = load_model(path)
|
20 |
+
#aks end-----------
|
21 |
+
# model = tf.keras.models.load_model((path),custom_objects={"KerasLayer":hub.KerasLayer})
|
22 |
|
23 |
labels = ['affenpinscher', 'afghan_hound', 'african_hunting_dog', 'airedale',
|
24 |
'american_staffordshire_terrier', 'appenzeller',
|