Update app.py
Browse files
app.py
CHANGED
|
@@ -41,10 +41,17 @@ def display_category(cls_name):
|
|
| 41 |
|
| 42 |
# ββ Load model βββββββββββββββββββββββββββββββββββββββββββββββ
|
| 43 |
print("Loading model...")
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
import keras
|
| 46 |
keras.config.enable_unsafe_deserialization()
|
| 47 |
-
model = tf.keras.models.
|
|
|
|
| 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 βββββββββββββββββββββββββββββββββββββββ
|