Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
99 |
-
model = tf.keras.models.load_model(local_filename)
|
100 |
-
|
101 |
-
print(
|
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 |
##############
|