Views
No views yet
1from tensorflow.keras.models import load_model
2import numpy as np
3import cv2
4
5# Load the model
6model = load_model('path_to_model.hebrew_letter_model.keras')
7
8# Preprocess an input image (example for one letter)
9img = cv2.imread('path_to_image.jpg', cv2.IMREAD_GRAYSCALE)
10img_resized = cv2.resize(img, (64, 64)) / 255.0
11img_array = np.expand_dims(img_resized, axis=0)
12
13# Predict
14predictions = model.predict(img_array)
15predicted_class = np.argmax(predictions, axis=1)[0]
16
17# Class names for Hebrew letters
18class_names = ['stop', 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'ך', 'כ', 'ל', 'ם', 'מ', 'ן', 'נ', 'ס', 'ע', 'ף', 'פ', 'ץ', 'צ', 'ק', 'ר', 'ש', 'ת']
19
20print("Predicted letter:", class_names[predicted_class])
211@misc{hebrew-letter-recognition,
2 title={Hebrew Manuscripts Letter Recognition Model},
3 author={Benjamin Schnabel},
4 year={2024},
5 howpublished={\url{https://huggingface.co/bsesic/HebrewManuscriptsMNIST}},
6}