yashbyname commited on
Commit
f7e3b0e
·
verified ·
1 Parent(s): 3b94b0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -39,12 +39,11 @@ def load_model():
39
  # Try loading with different configurations
40
  try:
41
  logger.info("Attempting to load model with custom objects...")
42
- with tf.keras.utils.custom_object_scope(custom_objects):
43
- model = tf_keras.models.load_model(model_path, compile=False)
44
  except Exception as e:
45
  logger.error(f"Failed to load with custom objects: {str(e)}")
46
  logger.info("Attempting to load model without custom objects...")
47
- model = tf_keras.models.load_model(model_path, compile=False)
48
 
49
  # Verify model loaded correctly
50
  if model is None:
 
39
  # Try loading with different configurations
40
  try:
41
  logger.info("Attempting to load model with custom objects...")
42
+ model = tf_keras.models.load_model(model_path, custom_objects={'KerasLayer': hub.KerasLayer})
 
43
  except Exception as e:
44
  logger.error(f"Failed to load with custom objects: {str(e)}")
45
  logger.info("Attempting to load model without custom objects...")
46
+ model = tf_keras.models.load_model(model_path)
47
 
48
  # Verify model loaded correctly
49
  if model is None: