Unearthed commited on
Commit
92574e6
Β·
verified Β·
1 Parent(s): cad9345

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -41,10 +41,17 @@ def display_category(cls_name):
41
 
42
  # ── Load model ───────────────────────────────────────────────
43
  print("Loading model...")
44
- model_path = hf_hub_download(repo_id=MODEL_REPO, filename=MODEL_FILE)
 
 
 
 
 
 
45
  import keras
46
  keras.config.enable_unsafe_deserialization()
47
- model = tf.keras.models.load_model(model_path, compile=False)
 
48
  print("Model ready!")
49
 
50
  # ── Feature extraction ───────────────────────────────────────
 
41
 
42
  # ── Load model ───────────────────────────────────────────────
43
  print("Loading model...")
44
+ config_path = hf_hub_download(repo_id=MODEL_REPO, filename="model_config.json")
45
+ weights_path = hf_hub_download(repo_id=MODEL_REPO, filename="weights.weights.h5")
46
+
47
+ with open(config_path) as f:
48
+ config = f.read()
49
+
50
+ from tensorflow.keras.applications.efficientnet import preprocess_input
51
  import keras
52
  keras.config.enable_unsafe_deserialization()
53
+ model = tf.keras.models.model_from_json(config)
54
+ model.load_weights(weights_path)
55
  print("Model ready!")
56
 
57
  # ── Feature extraction ───────────────────────────────────────