Obai33 commited on
Commit
78ab44a
·
verified ·
1 Parent(s): 784c876

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -95,14 +95,19 @@ response = requests.get(url)
95
  with open(local_filename, 'wb') as f:
96
  f.write(response.content)
97
 
98
- print('error not here')
99
-
100
  # Load the pre-trained model
101
  model = tf.keras.models.load_model(local_filename)
102
 
103
- model.layers[0].cell.recurrent_initializer = 'glorot_uniform'
104
- print('error not here')
105
 
 
 
 
 
 
 
 
 
 
106
  ##############
107
 
108
  # Import the necessary library for translation
 
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
 
102
+ # Check if the 'glorot_uniform' initializer is available
103
+ if 'glorot_uniform' in tf.keras.initializers.__dict__:
104
+ model.layers[0].cell.recurrent_initializer = 'glorot_uniform' # If available, use directly
105
+ else:
106
+ # If not available, try instantiating the initializer
107
+ from tensorflow.keras.initializers import GlorotUniform
108
+ model.layers[0].cell.recurrent_initializer = GlorotUniform()print('error not here')
109
+
110
+ print('ok model loaded')
111
  ##############
112
 
113
  # Import the necessary library for translation