Minbz commited on
Commit
a4a80fb
·
verified ·
1 Parent(s): 3d8082b

Added custom_objects when loading the model

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -6,10 +6,12 @@ import tensorflow as tf
6
 
7
  model_pb_path = "./4-15_ViT-B16_Lung3_v1/saved_model.pb"
8
  model_keras_path = "model.keras"
9
- model = tf.keras.models.load_model(model_keras_path)
10
- model.compile(optimizer=Adam(learning_rate=0.0001),
11
- loss='binary_crossentropy',
12
- metrics=['accuracy'])
 
 
13
 
14
  # Define preprocessing function
15
  def preprocess_image(image):
 
6
 
7
  model_pb_path = "./4-15_ViT-B16_Lung3_v1/saved_model.pb"
8
  model_keras_path = "model.keras"
9
+
10
+ model = tf.keras.models.load_model(model_keras_path, custom_objects={'KerasLayer': hub.KerasLayer})
11
+
12
+ # model.compile(optimizer=Adam(learning_rate=0.0001),
13
+ # loss='binary_crossentropy',
14
+ # metrics=['accuracy'])
15
 
16
  # Define preprocessing function
17
  def preprocess_image(image):