@rajeev02/edge-ai 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +147 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,147 @@
1
+ # @rajeev02/edge-ai
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@rajeev02/edge-ai.svg)](https://www.npmjs.com/package/@rajeev02/edge-ai)
4
+ [![license](https://img.shields.io/npm/l/@rajeev02/edge-ai.svg)](https://github.com/Rajeev02/rajeev-sdk/blob/main/LICENSE)
5
+
6
+ **On-device ML toolkit** with Indian ID card OCR (Aadhaar/PAN/DL), model pipeline (TFLite/CoreML/ONNX/WASM), and voice AI in 11 Indian languages.
7
+
8
+ Part of [Rajeev SDK](https://github.com/Rajeev02/rajeev-sdk) — cross-platform infrastructure libraries for building apps that work everywhere.
9
+
10
+ ## Why use this?
11
+
12
+ - **Indian ID OCR** — Extract and validate Aadhaar, PAN, Driving License from scanned text. Verhoeff checksum for Aadhaar.
13
+ - **ML model pipeline** — Register, load, and run TFLite / CoreML / ONNX / WASM models with a unified API
14
+ - **Voice AI** — Parse voice commands in 11 Indian languages (Hindi, Tamil, Bengali, Telugu, Marathi, Gujarati, Kannada, Malayalam, Odia, Punjabi, English)
15
+ - **Intent detection** — "pay 500 to Rajeev" → `{ intent: "pay", entities: { amount: "500", recipient: "Rajeev" } }`
16
+ - **GPU acceleration** — Optional GPU backend for TFLite and CoreML models
17
+ - **Privacy-first** — All processing happens on device. No data sent to cloud servers.
18
+
19
+ ## Platform Support
20
+
21
+ | Platform | Engine | Status |
22
+ | ---------- | ---------- | ------ |
23
+ | iOS 16+ | TypeScript | ✅ |
24
+ | Android 7+ | TypeScript | ✅ |
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ npm install @rajeev02/edge-ai
30
+ ```
31
+
32
+ ### Peer Dependencies
33
+
34
+ - `react` >= 18.3.0
35
+ - `react-native` >= 0.84.0 _(optional)_
36
+
37
+ ## Quick Start
38
+
39
+ ### Indian ID OCR
40
+
41
+ ```typescript
42
+ import {
43
+ detectDocumentType,
44
+ extractPanNumber,
45
+ extractAadhaarNumber,
46
+ validatePan,
47
+ validateAadhaar,
48
+ getScanningTips,
49
+ } from "@rajeev02/edge-ai";
50
+
51
+ // Detect document type from OCR text
52
+ const docType = detectDocumentType("Income Tax Department PAN ABCPE1234F");
53
+ // → "pan"
54
+
55
+ // Extract PAN
56
+ const pan = extractPanNumber("Name: Rajeev PAN: ABCPE1234F DOB: 01/01/1990");
57
+ // → "ABCPE1234F"
58
+
59
+ // Extract masked Aadhaar
60
+ const aadhaar = extractAadhaarNumber("Aadhaar: 1234 5678 9012");
61
+ // → "XXXX XXXX 9012"
62
+
63
+ // Validate
64
+ validatePan("ABCPE1234F"); // → true
65
+ validateAadhaar("123456789012"); // → true (Verhoeff checksum)
66
+
67
+ // Get scanning tips for users
68
+ getScanningTips("aadhaar");
69
+ // → ["Place the card on a flat surface", "Ensure all four corners are visible", ...]
70
+ ```
71
+
72
+ ### ML Model Pipeline
73
+
74
+ ```typescript
75
+ import { ModelManager } from "@rajeev02/edge-ai";
76
+
77
+ const mm = new ModelManager();
78
+
79
+ // Register a model
80
+ mm.register({
81
+ id: "face_detect",
82
+ name: "Face Detection",
83
+ modelPath: "models/face.tflite",
84
+ backend: "tflite",
85
+ useGpu: true,
86
+ });
87
+
88
+ // Load into memory
89
+ await mm.load("face_detect");
90
+ console.log(mm.isReady("face_detect")); // → true
91
+
92
+ // Get model info
93
+ const info = mm.getModelInfo("face_detect");
94
+ // → { id, name, status: "ready", backend, sizeBytes, loadTimeMs }
95
+
96
+ // Unload when done
97
+ mm.unload("face_detect");
98
+ ```
99
+
100
+ ### Voice AI
101
+
102
+ ```typescript
103
+ import { parseVoiceIntent, SUPPORTED_VOICE_LANGUAGES } from "@rajeev02/edge-ai";
104
+
105
+ // Parse natural language commands
106
+ const intent = parseVoiceIntent("pay 500 to Rajeev", "en");
107
+ // → { intent: "pay", confidence: 0.95, entities: { amount: "500", recipient: "Rajeev" }, language: "en" }
108
+
109
+ const hindiIntent = parseVoiceIntent("Rajeev ko 500 bhejo", "hi");
110
+ // → { intent: "pay", confidence: 0.92, entities: { amount: "500", recipient: "Rajeev" }, language: "hi" }
111
+
112
+ // 11 supported languages
113
+ console.log(SUPPORTED_VOICE_LANGUAGES);
114
+ // → ["en", "hi", "ta", "bn", "te", "mr", "gu", "kn", "ml", "or", "pa"]
115
+ ```
116
+
117
+ ## Supported Document Types
118
+
119
+ | Type | Detection Keywords | Extraction |
120
+ | --------------- | ------------------------------- | -------------------------- |
121
+ | Aadhaar | "UIDAI", "Aadhaar" | Number (masked), name, DOB |
122
+ | PAN | "Income Tax", "PAN" | PAN number, name, DOB |
123
+ | Driving License | "Driving", "License", "DL" | DL number, name, validity |
124
+ | Voter ID | "Election Commission" | Voter ID, name |
125
+ | Passport | "Passport", "Republic of India" | Passport number, name |
126
+
127
+ ## API Reference
128
+
129
+ | Export | Type | Description |
130
+ | --------------------------- | ---------- | ----------------------------------- |
131
+ | `detectDocumentType()` | `function` | Detect Indian ID type from OCR text |
132
+ | `extractAadhaarNumber()` | `function` | Extract masked Aadhaar number |
133
+ | `extractPanNumber()` | `function` | Extract PAN number |
134
+ | `validatePan()` | `function` | Validate PAN format |
135
+ | `validateAadhaar()` | `function` | Validate Aadhaar (Verhoeff) |
136
+ | `getScanningTips()` | `function` | Get user-facing scanning tips |
137
+ | `ModelManager` | `class` | ML model lifecycle management |
138
+ | `parseVoiceIntent()` | `function` | Parse voice commands to intents |
139
+ | `SUPPORTED_VOICE_LANGUAGES` | `string[]` | List of supported languages |
140
+
141
+ ## Full Documentation
142
+
143
+ 📖 [Complete API docs with model config and voice AI](https://github.com/Rajeev02/rajeev-sdk/blob/main/docs/usage/EDGE-AI.md)
144
+
145
+ ## License
146
+
147
+ MIT © 2026 [Rajeev Kumar Joshi](https://rajeev02.github.io)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rajeev02/edge-ai",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Edge AI / On-Device ML Toolkit — OCR, face detection, voice commands, document scanner, smart crop",
5
5
  "main": "lib/index.js",
6
6
  "author": "Rajeev Kumar Joshi <rajeevjoshi91@gmail.com> (https://rajeev02.github.io)",