Spaces:
Sleeping
Sleeping
import tensorflow as tf | |
from tensorflow.keras.preprocessing import image | |
import numpy as np | |
from huggingface_hub import from_pretrained_keras | |
model = from_pretrained_keras("okeowo1014/catsanddogs") | |
# Load the saved model | |
loaded_model = tf.keras.models.load_model('fingerprint_recognition_model.keras') | |
# Define the image path for the new image you want to predict | |
image_path = 'path_to_your_new_image.jpg' | |
# Load and preprocess the image | |
img = image.load_img(image_path, target_size=(224, 224), color_mode='grayscale') | |
img_array = image.img_to_array(img) | |
img_array = np.expand_dims(img_array, axis=0) | |
img_array /= 255. # Normalize the image data | |
# Make predictions | |
predictions = loaded_model.predict(img_array) | |
# Get the predicted class label | |
predicted_class = np.argmax(predictions[0]) | |
# Print the predicted class label | |
print(f'Predicted class label: {predicted_class}') | |