Spaces:
Running
Running
update
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ CORS(app)
|
|
| 14 |
|
| 15 |
# ================== 🔧 LOAD MODEL ==================
|
| 16 |
# Lưu ý: Đảm bảo tên file model đúng với file ông đã up lên
|
| 17 |
-
MODEL_PATH = "
|
| 18 |
try:
|
| 19 |
model = tf.keras.models.load_model(MODEL_PATH)
|
| 20 |
print("✅ Model loaded successfully!")
|
|
@@ -32,7 +32,7 @@ CLASS_NAMES = [
|
|
| 32 |
# ================== 🖼️ PREPROCESS ==================
|
| 33 |
def preprocess_image(image_file):
|
| 34 |
img = Image.open(image_file).convert("RGB")
|
| 35 |
-
img = img.resize((
|
| 36 |
img_array = np.array(img) / 255.0
|
| 37 |
img_array = np.expand_dims(img_array, axis=0)
|
| 38 |
return img_array
|
|
|
|
| 14 |
|
| 15 |
# ================== 🔧 LOAD MODEL ==================
|
| 16 |
# Lưu ý: Đảm bảo tên file model đúng với file ông đã up lên
|
| 17 |
+
MODEL_PATH = "model_tra_phu_hoi.keras"
|
| 18 |
try:
|
| 19 |
model = tf.keras.models.load_model(MODEL_PATH)
|
| 20 |
print("✅ Model loaded successfully!")
|
|
|
|
| 32 |
# ================== 🖼️ PREPROCESS ==================
|
| 33 |
def preprocess_image(image_file):
|
| 34 |
img = Image.open(image_file).convert("RGB")
|
| 35 |
+
img = img.resize((224, 224))
|
| 36 |
img_array = np.array(img) / 255.0
|
| 37 |
img_array = np.expand_dims(img_array, axis=0)
|
| 38 |
return img_array
|