Spaces:
Sleeping
Sleeping
Abdul Rafay commited on
Commit Β·
aedb7f1
1
Parent(s): a4ef98f
readme file added
Browse files
readme.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Numera
|
| 3 |
+
emoji: π’
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_file: main.py
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# π’ Numera
|
| 12 |
+
|
| 13 |
+
### From Scribble to Signal.
|
| 14 |
+
|
| 15 |
+
Numera is a neural networkβpowered web app that recognizes handwritten digits (0β9).
|
| 16 |
+
Draw a number on the canvas and let the model predict it in real time.
|
| 17 |
+
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
## π§ About the Model
|
| 21 |
+
|
| 22 |
+
- Built with **PyTorch**
|
| 23 |
+
- Convolutional Neural Network (CNN)
|
| 24 |
+
- Trained on the **MNIST dataset**
|
| 25 |
+
- ~98% accuracy
|
| 26 |
+
- CPU-optimized for fast inference
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## βοΈ How It Works
|
| 31 |
+
|
| 32 |
+
1. User draws a digit on the canvas
|
| 33 |
+
2. Image is converted to grayscale
|
| 34 |
+
3. Image is inverted (to match MNIST format)
|
| 35 |
+
4. Resized to 28Γ28
|
| 36 |
+
5. Passed through the CNN model
|
| 37 |
+
6. Prediction + confidence score returned
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## π Tech Stack
|
| 42 |
+
|
| 43 |
+
- **FastAPI** β Backend API
|
| 44 |
+
- **Gradio** β Interactive frontend
|
| 45 |
+
- **PyTorch** β Model inference
|
| 46 |
+
- **Docker** β Deployment
|
| 47 |
+
- Hosted on **Hugging Face Spaces**
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## π Deployment
|
| 52 |
+
|
| 53 |
+
This Space uses the **Docker runtime**.
|
| 54 |
+
|
| 55 |
+
The container:
|
| 56 |
+
- Installs dependencies
|
| 57 |
+
- Loads `model.pt`
|
| 58 |
+
- Runs `uvicorn main:app`
|
| 59 |
+
- Serves the app on port 7860
|
| 60 |
+
|
| 61 |
+
---
|
| 62 |
+
|
| 63 |
+
## π Project Structure
|
| 64 |
+
|
| 65 |
+
.
|
| 66 |
+
βββ main.py # FastAPI + Gradio app
|
| 67 |
+
βββ model.py # CNN architecture
|
| 68 |
+
βββ model.pt # Trained weights (Git LFS)
|
| 69 |
+
βββ requirements.txt
|
| 70 |
+
βββ Dockerfile
|
| 71 |
+
βββ README.md
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## π― Features
|
| 77 |
+
|
| 78 |
+
βοΈ Draw digits directly in browser
|
| 79 |
+
βοΈ Real-time prediction
|
| 80 |
+
βοΈ Confidence score display
|
| 81 |
+
βοΈ Lightweight CPU deployment
|
| 82 |
+
|
| 83 |
+
---
|
| 84 |
+
|
| 85 |
+
## π¨βπ» Author
|
| 86 |
+
|
| 87 |
+
Developed by **Abdul Rafay**
|
| 88 |
+
Computer Science student building AI-powered systems.
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## π Future Improvements
|
| 93 |
+
|
| 94 |
+
- Probability distribution chart
|
| 95 |
+
- Model versioning
|
| 96 |
+
- GPU support
|
| 97 |
+
- Improved preprocessing pipeline
|
| 98 |
+
- CI/CD integration
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
β¨ Thank you for trying Numera!
|