|
|
--- |
|
|
pipeline_tag: image-classification |
|
|
license: mit |
|
|
library_name: pytorch |
|
|
tags: [pytorch, minimal, demo] |
|
|
model-index: |
|
|
- name: tiny-digits-cnn |
|
|
results: |
|
|
- task: {type: image-classification} |
|
|
metrics: |
|
|
- type: accuracy |
|
|
value: 0.00 |
|
|
--- |
|
|
|
|
|
# Tiny Digits CNN (demo-only) |
|
|
|
|
|
Toy 28×28 grayscale classifier (10 classes 0–9) for **Hugging Face deployment tests**. |
|
|
No training—weights are randomly initialized just to validate repo layout, Spaces, and Inference Endpoints. |
|
|
|
|
|
## Files |
|
|
- `model.py` — tiny CNN |
|
|
- `model.safetensors` — weights (create with `python generate_weights.py`) |
|
|
- `inference.py` — load → preprocess → predict |
|
|
- `handler.py` — Endpoint handler (`EndpointHandler`) |
|
|
- `app.py` — Gradio Space UI |
|
|
- `requirements.txt`, `.gitattributes`, `LICENSE` |
|
|
|
|
|
## Quickstart (local) |
|
|
```bash |
|
|
pip install -r requirements.txt |
|
|
python generate_weights.py |
|
|
python app.py |
|
|
|
|
|
Call via Hosted Inference API (if enabled) or Endpoint |
|
|
# Replace with your endpoint URL or model API URL |
|
|
API=https://api-inference.huggingface.co/models/ORG/REPO |
|
|
curl -X POST "$API" \ |
|
|
-H "Authorization: Bearer $HF_TOKEN" \ |
|
|
-H "Content-Type: application/json" \ |
|
|
-d '{"inputs": {"image_base64": "<PUT_BASE64_IMAGE_HERE>"}}' |
|
|
|
|
|
|