courte commited on
Commit
d40745f
·
verified ·
1 Parent(s): 57cee7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -10,10 +10,11 @@ model = tf.keras.models.load_model("car_brand_classifier_final.h5", compile=Fals
10
  # Define image directory where car brand images are stored
11
  IMAGE_DIR = "car_brands" # Make sure this folder exists with images named as class labels
12
 
13
- # Preprocess image to match EfficientNetB0 input requirements
14
- def preprocess_image(image):
15
- image = image.resize((224, 224)) # Resize to match EfficientNetB0
16
- image = np.array(image) / 255.0 # Normalize
 
17
  image = np.expand_dims(image, axis=0) # Add batch dimension
18
  return image
19
 
 
10
  # Define image directory where car brand images are stored
11
  IMAGE_DIR = "car_brands" # Make sure this folder exists with images named as class labels
12
 
13
+ # Define the preprocessing function
14
+ def preprocess_image(image_path):
15
+ image = Image.open(image_path) # Open image from path
16
+ image = image.resize((299, 299)) # Resize to model input size
17
+ image = np.array(image) / 255.0 # Normalize pixel values
18
  image = np.expand_dims(image, axis=0) # Add batch dimension
19
  return image
20