saral 0.1.0__tar.gz

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 (67) hide show
  1. saral-0.1.0/.gitignore +17 -0
  2. saral-0.1.0/LICENSE +202 -0
  3. saral-0.1.0/NOTICE +10 -0
  4. saral-0.1.0/PKG-INFO +174 -0
  5. saral-0.1.0/README.md +125 -0
  6. saral-0.1.0/docs/ARCHITECTURE.md +62 -0
  7. saral-0.1.0/docs/EDGE_CASES.md +73 -0
  8. saral-0.1.0/docs/RELEASING.md +24 -0
  9. saral-0.1.0/docs/ROADMAP.md +53 -0
  10. saral-0.1.0/docs/THIRD_PARTY.md +37 -0
  11. saral-0.1.0/evals/documents.jsonl +10 -0
  12. saral-0.1.0/evals/scam.jsonl +32 -0
  13. saral-0.1.0/pyproject.toml +84 -0
  14. saral-0.1.0/src/saral/__init__.py +7 -0
  15. saral-0.1.0/src/saral/__main__.py +3 -0
  16. saral-0.1.0/src/saral/app.py +129 -0
  17. saral-0.1.0/src/saral/autostart.py +77 -0
  18. saral-0.1.0/src/saral/binaries.py +124 -0
  19. saral-0.1.0/src/saral/cli.py +161 -0
  20. saral-0.1.0/src/saral/config.py +84 -0
  21. saral-0.1.0/src/saral/discover.py +319 -0
  22. saral-0.1.0/src/saral/engine.py +159 -0
  23. saral-0.1.0/src/saral/engine_fetch.py +162 -0
  24. saral-0.1.0/src/saral/evals.py +155 -0
  25. saral-0.1.0/src/saral/extract.py +394 -0
  26. saral-0.1.0/src/saral/guard.py +84 -0
  27. saral-0.1.0/src/saral/i18n.py +292 -0
  28. saral-0.1.0/src/saral/jobs/__init__.py +1 -0
  29. saral-0.1.0/src/saral/jobs/explain.py +189 -0
  30. saral-0.1.0/src/saral/jobs/scam.py +361 -0
  31. saral-0.1.0/src/saral/llm.py +161 -0
  32. saral-0.1.0/src/saral/models.py +458 -0
  33. saral-0.1.0/src/saral/ocr.py +102 -0
  34. saral-0.1.0/src/saral/pairing.py +62 -0
  35. saral-0.1.0/src/saral/probe.py +92 -0
  36. saral-0.1.0/src/saral/prompts.py +68 -0
  37. saral-0.1.0/src/saral/safety.py +102 -0
  38. saral-0.1.0/src/saral/server.py +454 -0
  39. saral-0.1.0/src/saral/setup_api.py +190 -0
  40. saral-0.1.0/src/saral/speech.py +59 -0
  41. saral-0.1.0/src/saral/web/app.js +372 -0
  42. saral-0.1.0/src/saral/web/i18n.js +164 -0
  43. saral-0.1.0/src/saral/web/icon.svg +5 -0
  44. saral-0.1.0/src/saral/web/index.html +114 -0
  45. saral-0.1.0/src/saral/web/manifest.webmanifest +17 -0
  46. saral-0.1.0/src/saral/web/setup-i18n.js +270 -0
  47. saral-0.1.0/src/saral/web/setup.css +153 -0
  48. saral-0.1.0/src/saral/web/setup.html +128 -0
  49. saral-0.1.0/src/saral/web/setup.js +324 -0
  50. saral-0.1.0/src/saral/web/style.css +253 -0
  51. saral-0.1.0/src/saral/web/sw.js +29 -0
  52. saral-0.1.0/tests/__init__.py +0 -0
  53. saral-0.1.0/tests/conftest.py +8 -0
  54. saral-0.1.0/tests/fakes/fake_llama_server.py +53 -0
  55. saral-0.1.0/tests/test_api.py +136 -0
  56. saral-0.1.0/tests/test_discover.py +362 -0
  57. saral-0.1.0/tests/test_explain.py +80 -0
  58. saral-0.1.0/tests/test_extract.py +93 -0
  59. saral-0.1.0/tests/test_guard.py +27 -0
  60. saral-0.1.0/tests/test_llm_and_probe.py +50 -0
  61. saral-0.1.0/tests/test_models.py +171 -0
  62. saral-0.1.0/tests/test_no_network.py +69 -0
  63. saral-0.1.0/tests/test_ocr.py +56 -0
  64. saral-0.1.0/tests/test_safety.py +43 -0
  65. saral-0.1.0/tests/test_scam.py +109 -0
  66. saral-0.1.0/tests/test_setup_flow.py +182 -0
  67. saral-0.1.0/tests/test_tiers_and_engine_fetch.py +293 -0
saral-0.1.0/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ venv/
6
+ build/
7
+ dist/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .coverage
11
+ htmlcov/
12
+ .DS_Store
13
+ # Local runtime data never belongs in git
14
+ .saral/
15
+ evals/results/
16
+ *.gguf
17
+ *.spec
saral-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
saral-0.1.0/NOTICE ADDED
@@ -0,0 +1,10 @@
1
+ Saral
2
+ Copyright 2026 Harishwar Reddy Korpol and the Saral contributors.
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ "Saral" and the Saral logo are trademarks of the project. The Apache License
7
+ does not grant permission to use these marks; see TRADEMARK.md.
8
+
9
+ Saral calls, but does not bundle, third-party models and tools. Each keeps its
10
+ own license. See docs/THIRD_PARTY.md for the list and the license traps we avoid.
saral-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.5
2
+ Name: saral
3
+ Version: 0.1.0
4
+ Summary: Saral: a private, voice-first AI helper that runs at home. Explains papers, checks for scams, in your own language.
5
+ Project-URL: Homepage, https://github.com/Fullcountr/saral
6
+ Project-URL: Documentation, https://github.com/Fullcountr/saral/tree/main/docs
7
+ Project-URL: Issues, https://github.com/Fullcountr/saral/issues
8
+ Project-URL: Changelog, https://github.com/Fullcountr/saral/releases
9
+ Author: Harishwar Reddy Korpol
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: accessibility,local-ai,multilingual,ocr,offline,privacy,scam-detection
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: End Users/Desktop
17
+ Classifier: Natural Language :: English
18
+ Classifier: Natural Language :: Hindi
19
+ Classifier: Natural Language :: Spanish
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
27
+ Classifier: Topic :: Security
28
+ Requires-Python: >=3.10
29
+ Requires-Dist: fastapi>=0.110
30
+ Requires-Dist: httpx>=0.27
31
+ Requires-Dist: pillow>=10.0
32
+ Requires-Dist: psutil>=5.9
33
+ Requires-Dist: pydantic>=2.6
34
+ Requires-Dist: pytesseract>=0.3.10
35
+ Requires-Dist: python-multipart>=0.0.9
36
+ Requires-Dist: qrcode>=7.4
37
+ Requires-Dist: uvicorn>=0.29
38
+ Provides-Extra: all
39
+ Requires-Dist: faster-whisper>=1.0; extra == 'all'
40
+ Provides-Extra: build
41
+ Requires-Dist: pyinstaller>=6.6; extra == 'build'
42
+ Provides-Extra: dev
43
+ Requires-Dist: pytest>=8.0; extra == 'dev'
44
+ Requires-Dist: ruff>=0.5; extra == 'dev'
45
+ Provides-Extra: ocr
46
+ Provides-Extra: speech
47
+ Requires-Dist: faster-whisper>=1.0; extra == 'speech'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # Saral
51
+
52
+ **A private AI helper that lives at home. Ask by voice, in your own language. Nothing leaves the house.**
53
+
54
+ *Saral* (सरल) means "simple." Saral is built for people who will never open a terminal: parents and grandparents, newcomers to a country, and small-business owners. It helps with the confusing moments that come up every week:
55
+
56
+ - **Is this a scam?** Forward or paste a suspicious SMS, WhatsApp message or email. Saral lists the warning signs in plain words and always tells you how to check safely.
57
+ - **What does this paper say?** Take a photo of a bill, notice or letter. Saral finds the amounts, dates and phone numbers exactly as written, and explains what it asks you to do.
58
+
59
+ Coming next: *help me reply*, *talk for me* (live translation) and *help me fill this form*. See the [roadmap](https://github.com/Fullcountr/saral/blob/main/docs/ROADMAP.md).
60
+
61
+ > **Status: v0.1 alpha.** The core loop works end to end. It is not yet ready for unsupervised use by vulnerable people. See [what v0.1 must prove](#what-v01-must-prove).
62
+
63
+ ---
64
+
65
+ ## The privacy promise
66
+
67
+ 1. **Everything runs on your own computer.** The AI model, speech recognition and photo reading all run locally. The only internet use is downloading the AI model once, from Hugging Face, which sends none of your data.
68
+ 2. **Saral refuses to send your data off the machine.** The model connection only accepts this computer or your home network, unless you explicitly change that.
69
+ 3. **No content telemetry, ever.** Photos are processed in memory and not stored.
70
+ 4. **Free and open source** under Apache 2.0. Anyone can read the code and check these claims.
71
+
72
+ ## How it works
73
+
74
+ ```
75
+ Phone (web app, paired by QR) ──home Wi-Fi──▶ Saral on a laptop or mini-PC
76
+ │
77
+ ├─ Read: photo → text (Tesseract OCR)
78
+ ├─ Facts: amounts, dates, phones, links (rules, not AI)
79
+ ├─ Think: explanation in your language (Qwen3, bundled llama.cpp engine)
80
+ ├─ Guard: no invented numbers, every point quoted from the paper
81
+ └─ Safety: fixed warnings, verification steps, emergency numbers
82
+ ```
83
+
84
+ **The design rule: extract facts deterministically, let the AI explain them, and let the human decide.**
85
+
86
+ - Numbers and dates are pulled out by rules, never by the model, and shown exactly as written.
87
+ - Every explanation point must quote the paper. Points that can't be matched are dropped.
88
+ - If the model writes a number that isn't on the paper, the answer is rejected and retried; if it still fails, Saral shows only the exact facts.
89
+ - Scam warnings and "how to check safely" steps are written by people, in every language, and always shown. Saral never says a message is "safe."
90
+ - Emergency phrases ("chest pain", "can't breathe", self-harm) get a fixed response with the right phone numbers before any AI runs.
91
+
92
+ ## Install (for families)
93
+
94
+ No terminal, no extra programs. Saral includes its own AI engine.
95
+
96
+ 1. **Download** the installer for your computer from the [Releases page](https://github.com/Fullcountr/saral/releases): `Saral-Setup.exe` for Windows, the `.dmg` for a Mac.
97
+ 2. **Double-click it.** A setup screen opens in your browser, in your language. It checks the computer and downloads Saral's AI once (1.3–5 GB, resumes if the internet drops). No internet? Use a Saral USB stick instead.
98
+ 3. **Scan the code** on the screen with your phone's camera, then tap "Add to Home screen."
99
+
100
+ That's it. Saral starts by itself whenever the computer turns on.
101
+
102
+ > The first public installers will appear with the first release. Until they are code-signed, Windows may say "Windows protected your PC" (click **More info → Run anyway**), and on a Mac you right-click Saral and choose **Open** the first time. Windows may also ask to allow Saral on your network: choose **Allow**, so your phone can reach it.
103
+
104
+ **Best for elders:** a family member sets it up once, or uses a preloaded Saral box (planned), so the person using Saral never installs anything.
105
+
106
+ ## Install with pip (for tech-comfortable users)
107
+
108
+ ```bash
109
+ pip install saral
110
+ saral # opens the setup screen; it downloads the AI engine and model for you
111
+ ```
112
+
113
+ To read photos of papers, also install Tesseract: `brew install tesseract tesseract-lang` (Mac), `sudo apt install tesseract-ocr tesseract-ocr-hin tesseract-ocr-tel` (Ubuntu), or the [Windows installer](https://github.com/UB-Mannheim/tesseract/wiki). The setup screen reminds you if it's missing.
114
+
115
+ ## For developers
116
+
117
+ ```bash
118
+ git clone https://github.com/Fullcountr/saral.git
119
+ cd saral
120
+ pip install -e ".[dev,ocr]"
121
+
122
+ saral # the same one-click app: opens the setup screen
123
+ saral doctor # what this computer has and which model tier it gets
124
+ ```
125
+
126
+ For AI answers during development, put llama.cpp's `llama-server` on your PATH (or set `SARAL_LLAMA_SERVER`). You can also use an existing Ollama install with `saral serve --backend ollama`, or run with no model at all: `saral serve --backend rules`.
127
+
128
+ Build the installer locally with `pip install -e ".[ocr,build]"`, then `python packaging/fetch_llama.py --platform <win-x64|macos-arm64|macos-x64|linux-x64>`, `python packaging/bundle_tesseract.py` and `python packaging/build.py`. Pushing a `v*` tag builds all installers in GitHub Actions ([release.yml](https://github.com/Fullcountr/saral/blob/main/.github/workflows/release.yml)).
129
+
130
+ ## Hardware tiers
131
+
132
+ `saral doctor` measures the machine and picks a tier automatically.
133
+
134
+ | Tier | Typical machine | Model | Good for |
135
+ | --- | --- | --- | --- |
136
+ | Lite | 8 GB laptop, no GPU | `qwen3:1.7b` | Scam checks, short documents; slower |
137
+ | Standard | 16 GB laptop or mini-PC | `qwen3:4b` | Everything in v0.1 at usable speed |
138
+ | Plus | 32 GB, Apple Silicon or 12 GB+ GPU | `qwen3:8b` | Long documents, better explanations |
139
+
140
+ ## Languages
141
+
142
+ v0.1 ships English, Hindi (हिन्दी), Telugu (తెలుగు) and Spanish. Safety text in Hindi, Telugu and Spanish **needs review by native speakers**; please help (see [CONTRIBUTING.md](https://github.com/Fullcountr/saral/blob/main/CONTRIBUTING.md)).
143
+
144
+ ## Testing and evals
145
+
146
+ ```bash
147
+ pytest # unit, API, safety and "no network" tests
148
+ saral eval --backend rules # deterministic evals (runs in CI)
149
+ saral eval --backend ollama # full evals with your local model
150
+ ```
151
+
152
+ The eval sets in [`evals/`](https://github.com/Fullcountr/saral/blob/main/evals/) are the most valuable part of the project: real-world-style messages and documents per language with ground truth. Contributions of new (anonymized or synthetic) cases are very welcome.
153
+
154
+ ## What v0.1 must prove
155
+
156
+ Before adding features, v0.1 has to pass its gate:
157
+
158
+ - Amounts and dates extracted exactly in ≥99% of eval documents, with zero changed digits in explanations.
159
+ - Zero outbound network connections during a full session (enforced by a test).
160
+ - Five real testers finish "is this a scam?" and "explain this paper" without help.
161
+
162
+ ## Project docs
163
+
164
+ - [Architecture](https://github.com/Fullcountr/saral/blob/main/docs/ARCHITECTURE.md)
165
+ - [Edge cases and how Saral handles them](https://github.com/Fullcountr/saral/blob/main/docs/EDGE_CASES.md)
166
+ - [Roadmap](https://github.com/Fullcountr/saral/blob/main/docs/ROADMAP.md)
167
+ - [Third-party models and licenses](https://github.com/Fullcountr/saral/blob/main/docs/THIRD_PARTY.md)
168
+ - [Security policy](https://github.com/Fullcountr/saral/blob/main/SECURITY.md) · [Trademark policy](https://github.com/Fullcountr/saral/blob/main/TRADEMARK.md) · [Contributing](https://github.com/Fullcountr/saral/blob/main/CONTRIBUTING.md)
169
+
170
+ ## License
171
+
172
+ Code: [Apache License 2.0](https://github.com/Fullcountr/saral/blob/main/LICENSE). The name "Saral" and its logo are covered by the [trademark policy](https://github.com/Fullcountr/saral/blob/main/TRADEMARK.md).
173
+
174
+ Saral explains and drafts; it does not give legal, medical or financial advice, and it never acts on your behalf.
saral-0.1.0/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # Saral
2
+
3
+ **A private AI helper that lives at home. Ask by voice, in your own language. Nothing leaves the house.**
4
+
5
+ *Saral* (सरल) means "simple." Saral is built for people who will never open a terminal: parents and grandparents, newcomers to a country, and small-business owners. It helps with the confusing moments that come up every week:
6
+
7
+ - **Is this a scam?** Forward or paste a suspicious SMS, WhatsApp message or email. Saral lists the warning signs in plain words and always tells you how to check safely.
8
+ - **What does this paper say?** Take a photo of a bill, notice or letter. Saral finds the amounts, dates and phone numbers exactly as written, and explains what it asks you to do.
9
+
10
+ Coming next: *help me reply*, *talk for me* (live translation) and *help me fill this form*. See the [roadmap](https://github.com/Fullcountr/saral/blob/main/docs/ROADMAP.md).
11
+
12
+ > **Status: v0.1 alpha.** The core loop works end to end. It is not yet ready for unsupervised use by vulnerable people. See [what v0.1 must prove](#what-v01-must-prove).
13
+
14
+ ---
15
+
16
+ ## The privacy promise
17
+
18
+ 1. **Everything runs on your own computer.** The AI model, speech recognition and photo reading all run locally. The only internet use is downloading the AI model once, from Hugging Face, which sends none of your data.
19
+ 2. **Saral refuses to send your data off the machine.** The model connection only accepts this computer or your home network, unless you explicitly change that.
20
+ 3. **No content telemetry, ever.** Photos are processed in memory and not stored.
21
+ 4. **Free and open source** under Apache 2.0. Anyone can read the code and check these claims.
22
+
23
+ ## How it works
24
+
25
+ ```
26
+ Phone (web app, paired by QR) ──home Wi-Fi──▶ Saral on a laptop or mini-PC
27
+ │
28
+ ├─ Read: photo → text (Tesseract OCR)
29
+ ├─ Facts: amounts, dates, phones, links (rules, not AI)
30
+ ├─ Think: explanation in your language (Qwen3, bundled llama.cpp engine)
31
+ ├─ Guard: no invented numbers, every point quoted from the paper
32
+ └─ Safety: fixed warnings, verification steps, emergency numbers
33
+ ```
34
+
35
+ **The design rule: extract facts deterministically, let the AI explain them, and let the human decide.**
36
+
37
+ - Numbers and dates are pulled out by rules, never by the model, and shown exactly as written.
38
+ - Every explanation point must quote the paper. Points that can't be matched are dropped.
39
+ - If the model writes a number that isn't on the paper, the answer is rejected and retried; if it still fails, Saral shows only the exact facts.
40
+ - Scam warnings and "how to check safely" steps are written by people, in every language, and always shown. Saral never says a message is "safe."
41
+ - Emergency phrases ("chest pain", "can't breathe", self-harm) get a fixed response with the right phone numbers before any AI runs.
42
+
43
+ ## Install (for families)
44
+
45
+ No terminal, no extra programs. Saral includes its own AI engine.
46
+
47
+ 1. **Download** the installer for your computer from the [Releases page](https://github.com/Fullcountr/saral/releases): `Saral-Setup.exe` for Windows, the `.dmg` for a Mac.
48
+ 2. **Double-click it.** A setup screen opens in your browser, in your language. It checks the computer and downloads Saral's AI once (1.3–5 GB, resumes if the internet drops). No internet? Use a Saral USB stick instead.
49
+ 3. **Scan the code** on the screen with your phone's camera, then tap "Add to Home screen."
50
+
51
+ That's it. Saral starts by itself whenever the computer turns on.
52
+
53
+ > The first public installers will appear with the first release. Until they are code-signed, Windows may say "Windows protected your PC" (click **More info → Run anyway**), and on a Mac you right-click Saral and choose **Open** the first time. Windows may also ask to allow Saral on your network: choose **Allow**, so your phone can reach it.
54
+
55
+ **Best for elders:** a family member sets it up once, or uses a preloaded Saral box (planned), so the person using Saral never installs anything.
56
+
57
+ ## Install with pip (for tech-comfortable users)
58
+
59
+ ```bash
60
+ pip install saral
61
+ saral # opens the setup screen; it downloads the AI engine and model for you
62
+ ```
63
+
64
+ To read photos of papers, also install Tesseract: `brew install tesseract tesseract-lang` (Mac), `sudo apt install tesseract-ocr tesseract-ocr-hin tesseract-ocr-tel` (Ubuntu), or the [Windows installer](https://github.com/UB-Mannheim/tesseract/wiki). The setup screen reminds you if it's missing.
65
+
66
+ ## For developers
67
+
68
+ ```bash
69
+ git clone https://github.com/Fullcountr/saral.git
70
+ cd saral
71
+ pip install -e ".[dev,ocr]"
72
+
73
+ saral # the same one-click app: opens the setup screen
74
+ saral doctor # what this computer has and which model tier it gets
75
+ ```
76
+
77
+ For AI answers during development, put llama.cpp's `llama-server` on your PATH (or set `SARAL_LLAMA_SERVER`). You can also use an existing Ollama install with `saral serve --backend ollama`, or run with no model at all: `saral serve --backend rules`.
78
+
79
+ Build the installer locally with `pip install -e ".[ocr,build]"`, then `python packaging/fetch_llama.py --platform <win-x64|macos-arm64|macos-x64|linux-x64>`, `python packaging/bundle_tesseract.py` and `python packaging/build.py`. Pushing a `v*` tag builds all installers in GitHub Actions ([release.yml](https://github.com/Fullcountr/saral/blob/main/.github/workflows/release.yml)).
80
+
81
+ ## Hardware tiers
82
+
83
+ `saral doctor` measures the machine and picks a tier automatically.
84
+
85
+ | Tier | Typical machine | Model | Good for |
86
+ | --- | --- | --- | --- |
87
+ | Lite | 8 GB laptop, no GPU | `qwen3:1.7b` | Scam checks, short documents; slower |
88
+ | Standard | 16 GB laptop or mini-PC | `qwen3:4b` | Everything in v0.1 at usable speed |
89
+ | Plus | 32 GB, Apple Silicon or 12 GB+ GPU | `qwen3:8b` | Long documents, better explanations |
90
+
91
+ ## Languages
92
+
93
+ v0.1 ships English, Hindi (हिन्दी), Telugu (తెలుగు) and Spanish. Safety text in Hindi, Telugu and Spanish **needs review by native speakers**; please help (see [CONTRIBUTING.md](https://github.com/Fullcountr/saral/blob/main/CONTRIBUTING.md)).
94
+
95
+ ## Testing and evals
96
+
97
+ ```bash
98
+ pytest # unit, API, safety and "no network" tests
99
+ saral eval --backend rules # deterministic evals (runs in CI)
100
+ saral eval --backend ollama # full evals with your local model
101
+ ```
102
+
103
+ The eval sets in [`evals/`](https://github.com/Fullcountr/saral/blob/main/evals/) are the most valuable part of the project: real-world-style messages and documents per language with ground truth. Contributions of new (anonymized or synthetic) cases are very welcome.
104
+
105
+ ## What v0.1 must prove
106
+
107
+ Before adding features, v0.1 has to pass its gate:
108
+
109
+ - Amounts and dates extracted exactly in ≥99% of eval documents, with zero changed digits in explanations.
110
+ - Zero outbound network connections during a full session (enforced by a test).
111
+ - Five real testers finish "is this a scam?" and "explain this paper" without help.
112
+
113
+ ## Project docs
114
+
115
+ - [Architecture](https://github.com/Fullcountr/saral/blob/main/docs/ARCHITECTURE.md)
116
+ - [Edge cases and how Saral handles them](https://github.com/Fullcountr/saral/blob/main/docs/EDGE_CASES.md)
117
+ - [Roadmap](https://github.com/Fullcountr/saral/blob/main/docs/ROADMAP.md)
118
+ - [Third-party models and licenses](https://github.com/Fullcountr/saral/blob/main/docs/THIRD_PARTY.md)
119
+ - [Security policy](https://github.com/Fullcountr/saral/blob/main/SECURITY.md) · [Trademark policy](https://github.com/Fullcountr/saral/blob/main/TRADEMARK.md) · [Contributing](https://github.com/Fullcountr/saral/blob/main/CONTRIBUTING.md)
120
+
121
+ ## License
122
+
123
+ Code: [Apache License 2.0](https://github.com/Fullcountr/saral/blob/main/LICENSE). The name "Saral" and its logo are covered by the [trademark policy](https://github.com/Fullcountr/saral/blob/main/TRADEMARK.md).
124
+
125
+ Saral explains and drafts; it does not give legal, medical or financial advice, and it never acts on your behalf.
@@ -0,0 +1,62 @@
1
+ # Architecture
2
+
3
+ Saral is one Python process on a laptop or mini-PC at home, plus a web app the phone opens over home Wi-Fi.
4
+
5
+ ```
6
+ Phone web app (src/saral/web) Home box (src/saral)
7
+ ┌────────────────────────────┐ ┌───────────────────────────────────────────────┐
8
+ │ big buttons, 4 languages │ HTTP + │ server.py FastAPI, pairing token, one model │
9
+ │ camera → downscaled JPEG │ token │ request at a time (queue) │
10
+ │ push-to-talk (needs HTTPS) │ ───────▶ │ safety.py emergency phrases → fixed answer │
11
+ │ read-aloud: on-device │ │ ocr.py photo quality check + Tesseract │
12
+ │ voices only │ │ extract.py amounts, dates, phones, links │
13
+ └────────────────────────────┘ │ jobs/ scam.py, explain.py │
14
+ │ guard.py no new numbers, quotes must match │
15
+ │ engine.py bundled llama-server (127.0.0.1) │
16
+ │ models.py one-time verified model download │
17
+ │ setup_api first-run screen, QR, auto-start │
18
+ │ i18n.py human-written safety text │
19
+ └───────────────────────────────────────────────┘
20
+ ```
21
+
22
+ ## Request flow: "What does this paper say?"
23
+
24
+ 1. Phone downscales the photo and posts it with the user's language.
25
+ 2. `safety.emergency_response` checks the user's own words (voice or question) first.
26
+ 3. `ocr.quality_issues` checks for dark, glary, blurry or tiny photos; `ocr.ocr_image` reads it.
27
+ 4. `extract.extract` pulls amounts, dates, phones, links and emails with their exact text and line.
28
+ 5. `jobs.scam.check_scam` runs on the document too, so a scam letter gets a warning.
29
+ 6. The model is asked for JSON: summary, points and actions, each with an exact quote.
30
+ 7. `guard.new_numbers` rejects any answer with numbers not on the paper; `guard.quote_in_source` drops points whose quotes don't match. One retry with the reason; then fall back to facts only.
31
+ 8. The phone renders with `textContent` only (no HTML from the model) and shows exact facts beside the explanation.
32
+
33
+ ## Request flow: "Is this a scam?"
34
+
35
+ Rules in `jobs/scam.py` score twelve kinds of warning sign in four languages, plus link checks (shorteners, raw IPs, risky endings, brand look-alikes). The model may add known signs and a short explanation, but it can never lower the level, its explanation is dropped if it contains numbers or the word "safe," and the human-written verification step is always shown. Levels are `high`, `some` and `none_found`; there is no "safe."
36
+
37
+ ## Why these choices
38
+
39
+ | Choice | Reason |
40
+ | --- | --- |
41
+ | Rules for numbers, model for words | A wrong amount or deadline is the worst failure; models garble numbers across languages. |
42
+ | Fixed safety text in `i18n.py` | Warnings must be correct every time, in every language. |
43
+ | Bundled llama.cpp + Qwen3 | Nothing extra to install; permissive licenses; runs on CPU; 119 training languages. |
44
+ | Tesseract first | Runs on any CPU; PaddleOCR/Docling are the upgrade path for forms and tables. |
45
+ | Plain JS, no build, no CDN | The app must load with no internet and be auditable. |
46
+ | Pairing token | Shared housing and hostels have shared Wi-Fi. |
47
+
48
+ ## Model backends
49
+
50
+ `llm.Backend` has four implementations: `LlamaCppBackend` (default: the bundled engine in `engine.py`), `OllamaBackend` (developers with Ollama), `RulesBackend` (no model, deterministic output only) and `FakeBackend` (tests). `check_local_url` refuses model hosts outside loopback or private network ranges unless `allow_remote_model_host` is set.
51
+
52
+ ## One-click app and first-run setup
53
+
54
+ `app.py` is what the desktop icon runs. It keeps a fixed port so paired phones keep working, opens the browser on `/setup` the first time and on `/` afterwards, and if Saral is already running just opens the window again. The setup screen (`web/setup.html`) walks through: language → computer check → model download (or USB offline pack) → engine start → phone QR code and "start with this computer" (on by default). Setup endpoints answer only requests from the computer itself, never from phones.
55
+
56
+ The model download (`models.py`) is the only internet use. It only fetches from Hugging Face, resumes partial downloads with HTTP Range, and checks the GGUF header, the size and the SHA-256 that Hugging Face publishes; a mismatch deletes the file.
57
+
58
+ ## Reusing what is already on the computer
59
+
60
+ `discover.py` looks for models other apps downloaded: Ollama (through its manifests to the model blob), LM Studio, Jan, the Hugging Face cache, and Downloads/Desktop. It reads each file's GGUF header and accepts only Qwen3 files of the sizes Saral is tested with (1.7B, 4B, 8B), so a different model can't silently lower answer quality. A chosen file is recorded in `model_links.json` and run where it is: no copy, and Saral never deletes it, because it belongs to the other app. If the file disappears later, setup simply offers a download again.
61
+
62
+ A running Ollama with a matching model can be used instead of Saral's engine; the choice is saved in `engine_choice.json`. For the engine itself, `binaries.llama_server_info()` prefers the bundled copy, then Saral's own download, then a system `llama-server` only if its build number is recent enough. A system engine that fails to start is remembered and skipped, so setup fetches Saral's own.