Ghaithhmz commited on
Commit
ecf5b01
·
1 Parent(s): 783f2cb

final config

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import tensorflow as tf
 
3
  import numpy as np
4
  import pandas as pd
5
  import os
@@ -28,13 +29,24 @@ def load_resources():
28
  if os.path.exists(MODEL_PATH):
29
  try:
30
  # Load the full multi-output model
31
- model = tf.keras.models.load_model(MODEL_PATH, compile=False)
 
 
 
 
 
 
 
 
32
  except Exception:
33
  try:
34
  model = tf.keras.models.load_model(
35
  MODEL_PATH,
36
  compile=False,
37
- custom_objects={"Dense": DenseCompat},
 
 
 
38
  )
39
  except Exception as inner_e:
40
  load_error = str(inner_e)
 
1
  import gradio as gr
2
  import tensorflow as tf
3
+ import keras
4
  import numpy as np
5
  import pandas as pd
6
  import os
 
29
  if os.path.exists(MODEL_PATH):
30
  try:
31
  # Load the full multi-output model
32
+ model = keras.saving.load_model(
33
+ MODEL_PATH,
34
+ compile=False,
35
+ safe_mode=False,
36
+ custom_objects={
37
+ "Dense": DenseCompat,
38
+ "keras.layers.Dense": DenseCompat,
39
+ },
40
+ )
41
  except Exception:
42
  try:
43
  model = tf.keras.models.load_model(
44
  MODEL_PATH,
45
  compile=False,
46
+ custom_objects={
47
+ "Dense": DenseCompat,
48
+ "keras.layers.Dense": DenseCompat,
49
+ },
50
  )
51
  except Exception as inner_e:
52
  load_error = str(inner_e)