Spaces:
Runtime error
Runtime error
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -1,3 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# AI Model Training Project
|
2 |
|
3 |
This project demonstrates a complete machine learning workflow from data preparation to model deployment, using the MNIST dataset with an innovative approach to digit recognition.
|
|
|
1 |
+
---
|
2 |
+
title: Digit Recognition with CNN
|
3 |
+
emoji: 🔢
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: indigo
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.19.2
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
+
# Digit Recognition Model
|
13 |
+
|
14 |
+
This model is trained to recognize handwritten digits from the MNIST dataset.
|
15 |
+
|
16 |
+
## Model Description
|
17 |
+
|
18 |
+
- **Model Type:** CNN with Attention
|
19 |
+
- **Task:** Image Classification
|
20 |
+
- **Input:** 28x28 grayscale images
|
21 |
+
- **Output:** Digit classification (0-9)
|
22 |
+
|
23 |
+
## Training
|
24 |
+
|
25 |
+
The model was trained on the MNIST dataset using a CNN architecture with attention mechanisms.
|
26 |
+
|
27 |
+
## Usage
|
28 |
+
|
29 |
+
```python
|
30 |
+
import tensorflow as tf
|
31 |
+
import numpy as np
|
32 |
+
|
33 |
+
# Load the model
|
34 |
+
model = tf.saved_model.load('https://huggingface.co/nivashuggingface/digit-recognition/resolve/main/saved_model')
|
35 |
+
|
36 |
+
# Prepare input
|
37 |
+
image = tf.keras.preprocessing.image.load_img("digit.png", target_size=(28, 28))
|
38 |
+
image = tf.keras.preprocessing.image.img_to_array(image)
|
39 |
+
image = image.astype('float32') / 255.0
|
40 |
+
image = np.expand_dims(image, axis=0)
|
41 |
+
|
42 |
+
# Make prediction
|
43 |
+
predictions = model(image)
|
44 |
+
predicted_digit = tf.argmax(predictions, axis=1).numpy()[0]
|
45 |
+
```
|
46 |
+
|
47 |
# AI Model Training Project
|
48 |
|
49 |
This project demonstrates a complete machine learning workflow from data preparation to model deployment, using the MNIST dataset with an innovative approach to digit recognition.
|