Spaces:
Runtime error
Runtime error
File size: 591 Bytes
0599704 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# Test the model with a sample image
import numpy as np
from PIL import Image
def test_model():
# Load a sample image
img_path = "./subaru.jpg"
img = Image.open(img_path).convert("RGB")
img = img.resize((299, 299))
img_array = np.array(img) / 255.0
img_array = np.expand_dims(img_array, axis=0)
# Make a prediction
predictions = model.predict(img_array)
predicted_class_index = np.argmax(predictions, axis=1)[0]
print(f"Predicted class index: {predicted_class_index}")
print(f"Predicted brand: {CAR_BRANDS[predicted_class_index]}")
test_model() |