Obai33 commited on
Commit
436765e
·
verified ·
1 Parent(s): f427500

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -95,18 +95,11 @@ response = requests.get(url)
95
  with open(local_filename, 'wb') as f:
96
  f.write(response.content)
97
 
98
- # Load the pre-trained model
99
- model = tf.keras.models.load_model(local_filename)
100
-
101
- print('at least the model is useable')
102
-
103
- # Check if the 'glorot_uniform' initializer is available
104
- if 'glorot_uniform' in tf.keras.initializers.__dict__:
105
- model.layers[0].cell.recurrent_initializer = 'glorot_uniform' # If available, use directly
106
- else:
107
- # If not available, try instantiating the initializer
108
- from tensorflow.keras.initializers import GlorotUniform
109
- model.layers[0].cell.recurrent_initializer = GlorotUniform()
110
 
111
  print('ok model loaded')
112
  ##############
 
95
  with open(local_filename, 'wb') as f:
96
  f.write(response.content)
97
 
98
+ try:
99
+ model = tf.keras.models.load_model(local_filename)
100
+ except Exception as e:
101
+ print("Error loading model:", e)
102
+
 
 
 
 
 
 
 
103
 
104
  print('ok model loaded')
105
  ##############