How to use from the
Use from the
TF-Keras library
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy)
# See https://github.com/keras-team/tf-keras for more details.
from huggingface_hub import from_pretrained_keras

model = from_pretrained_keras("nivashuggingface/digit-recognition")

Digit Recognition Model

This model is trained to recognize handwritten digits from the MNIST dataset.

Model Description

  • Model Type: CNN with Attention
  • Task: Image Classification
  • Input: 28x28 grayscale images
  • Output: Digit classification (0-9)

Training

The model was trained on the MNIST dataset using a CNN architecture with attention mechanisms.

Usage

import tensorflow as tf
import numpy as np

# Load the model
model = tf.saved_model.load("path_to_saved_model")

# Prepare input
image = tf.keras.preprocessing.image.load_img("digit.png", target_size=(28, 28))
image = tf.keras.preprocessing.image.img_to_array(image)
image = image.astype('float32') / 255.0
image = np.expand_dims(image, axis=0)

# Make prediction
predictions = model(image)
predicted_digit = tf.argmax(predictions, axis=1).numpy()[0]
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train nivashuggingface/digit-recognition

Space using nivashuggingface/digit-recognition 1