Update example.py
Browse files- example.py +19 -22
example.py
CHANGED
@@ -1,22 +1,19 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
#
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
#
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
else:
|
21 |
-
print(f"Predicted Class: {result['predicted_class']}")
|
22 |
-
print(f"Confidence: {result['confidence']}")
|
|
|
1 |
+
import os
|
2 |
+
os.environ["KERAS_BACKEND"] = "tensorflow"
|
3 |
+
|
4 |
+
import keras
|
5 |
+
from huggingface_hub import hf_hub_download
|
6 |
+
from PIL import Image
|
7 |
+
import numpy as np
|
8 |
+
|
9 |
+
# 1. Download the model file
|
10 |
+
print("--- Downloading model... ---")
|
11 |
+
model_path = hf_hub_download(
|
12 |
+
repo_id="VeduCo/D-Shepard-p1-57",
|
13 |
+
filename="ShepardsGift_final_model.keras" # Important: Use the correct filename
|
14 |
+
)
|
15 |
+
|
16 |
+
# 2. Load the model
|
17 |
+
model = keras.saving.load_model(model_path)
|
18 |
+
print("--- Model loaded successfully! ---")
|
19 |
+
model.summary()
|
|
|
|
|
|