Spaces:
Running
Running
update
Browse files
app.py
CHANGED
|
@@ -22,19 +22,17 @@ except Exception as e:
|
|
| 22 |
print(f"❌ Error loading model: {e}")
|
| 23 |
model = None
|
| 24 |
|
| 25 |
-
# ================== 🔍 CLASS LABELS ==================
|
| 26 |
CLASS_NAMES = [
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
"
|
| 30 |
-
"Lá Khỏe Mạnh (Healthy)", # Leaf_Healthy
|
| 31 |
-
"Đốm Mắt Cua (Phomopsis)", # Leaf_Phomopsis
|
| 32 |
]
|
| 33 |
|
| 34 |
# ================== 🖼️ PREPROCESS ==================
|
| 35 |
def preprocess_image(image_file):
|
| 36 |
img = Image.open(image_file).convert("RGB")
|
| 37 |
-
img = img.resize((
|
| 38 |
img_array = np.array(img) / 255.0
|
| 39 |
img_array = np.expand_dims(img_array, axis=0)
|
| 40 |
return img_array
|
|
|
|
| 22 |
print(f"❌ Error loading model: {e}")
|
| 23 |
model = None
|
| 24 |
|
| 25 |
+
# ================== 🔍 CLASS LABELS (CẬP NHẬT THEO MODEL MỚI) ==================
|
| 26 |
CLASS_NAMES = [
|
| 27 |
+
"Bệnh Nấm (Fungal Disease)", # Index 0
|
| 28 |
+
"Bệnh do Rệp (Aphids)", # Index 1
|
| 29 |
+
"Lá Khỏe Mạnh (Healthy)" # Index 2
|
|
|
|
|
|
|
| 30 |
]
|
| 31 |
|
| 32 |
# ================== 🖼️ PREPROCESS ==================
|
| 33 |
def preprocess_image(image_file):
|
| 34 |
img = Image.open(image_file).convert("RGB")
|
| 35 |
+
img = img.resize((260, 260))
|
| 36 |
img_array = np.array(img) / 255.0
|
| 37 |
img_array = np.expand_dims(img_array, axis=0)
|
| 38 |
return img_array
|
saurieng_mobilenetv2_model.keras → model_tra_phu_hoi.keras
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6160d5c7c73ba3b46c51b7442249453b729be17e4a8af50d34195578d0a4cb5f
|
| 3 |
+
size 79568367
|