crosscheck-vision 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.
@@ -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.
@@ -0,0 +1,128 @@
1
+ Metadata-Version: 2.4
2
+ Name: crosscheck-vision
3
+ Version: 0.1.0
4
+ Summary: Several local vision models describe a photo; hear where they agree and where they disagree. For blind and low-vision users.
5
+ Keywords: accessibility,blind,low-vision,image-description,ollama,vision-language-model
6
+ Author: Rush Labs
7
+ Author-email: Rush Labs <admin@rushlabs.ai>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Adaptive Technologies
16
+ Requires-Python: >=3.10
17
+ Project-URL: Homepage, https://rushlabs.ai/lab
18
+ Project-URL: Source, https://github.com/rushlabs-ai/crosscheck
19
+ Project-URL: Issues, https://github.com/rushlabs-ai/crosscheck/issues
20
+ Description-Content-Type: text/markdown
21
+
22
+ # Crosscheck
23
+
24
+ **A second opinion for AI photo descriptions.** Several vision models, running on your own
25
+ computer, describe the same photo. Crosscheck tells you what they all agree on, and, first and
26
+ most clearly, where they disagree.
27
+
28
+ Built for blind and low-vision people, who use AI descriptions for labels, medicine, mail and
29
+ screens but have no easy way to tell when a description is wrong.
30
+
31
+ ## Why
32
+
33
+ A single AI description sounds equally confident when it is right and when it is wrong. A study
34
+ at ASSETS 2025, [*Surfacing Variations to Calibrate Perceived Reliability of MLLM-generated Image
35
+ Descriptions*](https://arxiv.org/abs/2507.15692) (Meng Chen, Akhil Iyer, Amy Pavel), found that
36
+ when blind and low-vision participants were shown where several models' descriptions varied,
37
+ they spotted **4.9 times as many unreliable claims** as with a single description (2.62 against
38
+ 0.53 per image). 11 of 15 participants ranked that presentation as their favourite, and all of
39
+ them wanted to use it in the future.
40
+
41
+ Crosscheck brings that idea to models that run locally through [Ollama](https://ollama.com):
42
+ free, offline, and the photo never leaves your computer.
43
+
44
+ ## How it works
45
+
46
+ 1. Each model lists what it sees as short, separate facts, and quotes any text it can read.
47
+ 2. Facts that say the same thing are merged. Facts that differ in a **number or quoted text**
48
+ ("Ibuprofen 200 mg" against "400 mg") are kept apart, because that is where errors hide.
49
+ 3. Every model looks at the photo again and judges each fact the others stated: yes, no, or unsure.
50
+ 4. You hear a short summary first, for example:
51
+
52
+ > A pill bottle on a wooden table. The 3 models agree on 6 of 9 details. They disagree about:
53
+ > The label says "Ibuprofen 200 mg"; The label says "Ibuprofen 400 mg".
54
+
55
+ Then, on demand: what every model agrees on, where they disagree (and which model said what),
56
+ and details not every model could judge.
57
+
58
+ **Agreement is not proof.** Models can make the same mistake. For medicine, money or safety,
59
+ confirm with a person or another trusted source. Crosscheck never says "verified".
60
+
61
+ ## Install
62
+
63
+ 1. Install [Ollama](https://ollama.com) and pull three vision models from different families
64
+ (different families make different mistakes):
65
+
66
+ ```sh
67
+ ollama pull qwen3-vl:4b-instruct
68
+ ollama pull gemma4:e4b
69
+ ollama pull granite3.2-vision:2b
70
+ ```
71
+
72
+ 2. Install and start Crosscheck (Python 3.10+, no other dependencies):
73
+
74
+ ```sh
75
+ uv tool install crosscheck-vision # or: pipx install crosscheck-vision
76
+ crosscheck serve
77
+ ```
78
+
79
+ It opens http://127.0.0.1:8765 in your browser.
80
+
81
+ Choose other models with `--models a,b,c` (or `CROSSCHECK_MODELS`). With a 12–16 GB GPU, expect
82
+ about 30–90 seconds per photo while Ollama swaps the models in and out; a CPU works, slowly.
83
+
84
+ ## Using it
85
+
86
+ - **Web app**: choose a photo, optionally ask a question ("What does the label say?"), press
87
+ *Check photo*. Progress is announced; when the result is ready, focus moves to it. Everything
88
+ works with the keyboard and a screen reader. A checkbox can also read the result aloud with
89
+ the browser's own voice.
90
+ - **Terminal**: `crosscheck describe photo.jpg --question "What does the label say?"`, or `--json`
91
+ for the full result.
92
+
93
+ The web app shrinks the photo in your browser before sending it, which also removes metadata
94
+ such as GPS location.
95
+
96
+ ## Privacy and security
97
+
98
+ - Runs on 127.0.0.1 only. Photos stay in memory and go only to your Ollama. Nothing is logged.
99
+ - Requests must come from the app itself: a non-local `Host` (DNS rebinding) or a foreign
100
+ `Origin` (another website) is refused. A strict Content-Security-Policy blocks outside content.
101
+ - Model output is shown as text, never as HTML.
102
+
103
+ ## Status and limits
104
+
105
+ - v0.1, for desktop browsers on the same computer. Using a phone camera over Wi-Fi needs HTTPS
106
+ and is planned for v0.2.
107
+ - Merging facts across models uses word overlap, so two phrasings of one fact are sometimes
108
+ listed separately; each still gets judged.
109
+ - Small local models are weaker than the cloud models in the study. We are measuring how well
110
+ their disagreement predicts real errors on photos taken by blind people (VizWiz), and will
111
+ publish the results and timings here.
112
+
113
+ Feedback from blind and low-vision users matters most: please open an issue or email
114
+ admin@rushlabs.ai.
115
+
116
+ ## Development
117
+
118
+ ```sh
119
+ python -m unittest discover -s tests -v
120
+ ```
121
+
122
+ Tests run against a fake Ollama: merging and judging, a failing model, the web app's security
123
+ checks, the job queue and the CLI.
124
+
125
+ ## Licence
126
+
127
+ Apache-2.0. Built by [Rush Labs](https://rushlabs.ai), an applied AI lab. The models keep their
128
+ own licences (all three defaults are Apache-2.0).
@@ -0,0 +1,107 @@
1
+ # Crosscheck
2
+
3
+ **A second opinion for AI photo descriptions.** Several vision models, running on your own
4
+ computer, describe the same photo. Crosscheck tells you what they all agree on, and, first and
5
+ most clearly, where they disagree.
6
+
7
+ Built for blind and low-vision people, who use AI descriptions for labels, medicine, mail and
8
+ screens but have no easy way to tell when a description is wrong.
9
+
10
+ ## Why
11
+
12
+ A single AI description sounds equally confident when it is right and when it is wrong. A study
13
+ at ASSETS 2025, [*Surfacing Variations to Calibrate Perceived Reliability of MLLM-generated Image
14
+ Descriptions*](https://arxiv.org/abs/2507.15692) (Meng Chen, Akhil Iyer, Amy Pavel), found that
15
+ when blind and low-vision participants were shown where several models' descriptions varied,
16
+ they spotted **4.9 times as many unreliable claims** as with a single description (2.62 against
17
+ 0.53 per image). 11 of 15 participants ranked that presentation as their favourite, and all of
18
+ them wanted to use it in the future.
19
+
20
+ Crosscheck brings that idea to models that run locally through [Ollama](https://ollama.com):
21
+ free, offline, and the photo never leaves your computer.
22
+
23
+ ## How it works
24
+
25
+ 1. Each model lists what it sees as short, separate facts, and quotes any text it can read.
26
+ 2. Facts that say the same thing are merged. Facts that differ in a **number or quoted text**
27
+ ("Ibuprofen 200 mg" against "400 mg") are kept apart, because that is where errors hide.
28
+ 3. Every model looks at the photo again and judges each fact the others stated: yes, no, or unsure.
29
+ 4. You hear a short summary first, for example:
30
+
31
+ > A pill bottle on a wooden table. The 3 models agree on 6 of 9 details. They disagree about:
32
+ > The label says "Ibuprofen 200 mg"; The label says "Ibuprofen 400 mg".
33
+
34
+ Then, on demand: what every model agrees on, where they disagree (and which model said what),
35
+ and details not every model could judge.
36
+
37
+ **Agreement is not proof.** Models can make the same mistake. For medicine, money or safety,
38
+ confirm with a person or another trusted source. Crosscheck never says "verified".
39
+
40
+ ## Install
41
+
42
+ 1. Install [Ollama](https://ollama.com) and pull three vision models from different families
43
+ (different families make different mistakes):
44
+
45
+ ```sh
46
+ ollama pull qwen3-vl:4b-instruct
47
+ ollama pull gemma4:e4b
48
+ ollama pull granite3.2-vision:2b
49
+ ```
50
+
51
+ 2. Install and start Crosscheck (Python 3.10+, no other dependencies):
52
+
53
+ ```sh
54
+ uv tool install crosscheck-vision # or: pipx install crosscheck-vision
55
+ crosscheck serve
56
+ ```
57
+
58
+ It opens http://127.0.0.1:8765 in your browser.
59
+
60
+ Choose other models with `--models a,b,c` (or `CROSSCHECK_MODELS`). With a 12–16 GB GPU, expect
61
+ about 30–90 seconds per photo while Ollama swaps the models in and out; a CPU works, slowly.
62
+
63
+ ## Using it
64
+
65
+ - **Web app**: choose a photo, optionally ask a question ("What does the label say?"), press
66
+ *Check photo*. Progress is announced; when the result is ready, focus moves to it. Everything
67
+ works with the keyboard and a screen reader. A checkbox can also read the result aloud with
68
+ the browser's own voice.
69
+ - **Terminal**: `crosscheck describe photo.jpg --question "What does the label say?"`, or `--json`
70
+ for the full result.
71
+
72
+ The web app shrinks the photo in your browser before sending it, which also removes metadata
73
+ such as GPS location.
74
+
75
+ ## Privacy and security
76
+
77
+ - Runs on 127.0.0.1 only. Photos stay in memory and go only to your Ollama. Nothing is logged.
78
+ - Requests must come from the app itself: a non-local `Host` (DNS rebinding) or a foreign
79
+ `Origin` (another website) is refused. A strict Content-Security-Policy blocks outside content.
80
+ - Model output is shown as text, never as HTML.
81
+
82
+ ## Status and limits
83
+
84
+ - v0.1, for desktop browsers on the same computer. Using a phone camera over Wi-Fi needs HTTPS
85
+ and is planned for v0.2.
86
+ - Merging facts across models uses word overlap, so two phrasings of one fact are sometimes
87
+ listed separately; each still gets judged.
88
+ - Small local models are weaker than the cloud models in the study. We are measuring how well
89
+ their disagreement predicts real errors on photos taken by blind people (VizWiz), and will
90
+ publish the results and timings here.
91
+
92
+ Feedback from blind and low-vision users matters most: please open an issue or email
93
+ admin@rushlabs.ai.
94
+
95
+ ## Development
96
+
97
+ ```sh
98
+ python -m unittest discover -s tests -v
99
+ ```
100
+
101
+ Tests run against a fake Ollama: merging and judging, a failing model, the web app's security
102
+ checks, the job queue and the CLI.
103
+
104
+ ## Licence
105
+
106
+ Apache-2.0. Built by [Rush Labs](https://rushlabs.ai), an applied AI lab. The models keep their
107
+ own licences (all three defaults are Apache-2.0).
@@ -0,0 +1,47 @@
1
+ [project]
2
+ name = "crosscheck-vision"
3
+ version = "0.1.0"
4
+ description = "Several local vision models describe a photo; hear where they agree and where they disagree. For blind and low-vision users."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ keywords = [
10
+ "accessibility",
11
+ "blind",
12
+ "low-vision",
13
+ "image-description",
14
+ "ollama",
15
+ "vision-language-model",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Environment :: Web Environment",
20
+ "Intended Audience :: End Users/Desktop",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Topic :: Adaptive Technologies",
24
+ ]
25
+ dependencies = []
26
+
27
+ [[project.authors]]
28
+ name = "Rush Labs"
29
+ email = "admin@rushlabs.ai"
30
+
31
+ [project.scripts]
32
+ crosscheck = "crosscheck.cli:main"
33
+
34
+ [project.urls]
35
+ Homepage = "https://rushlabs.ai/lab"
36
+ Source = "https://github.com/rushlabs-ai/crosscheck"
37
+ Issues = "https://github.com/rushlabs-ai/crosscheck/issues"
38
+
39
+ [build-system]
40
+ requires = ["uv_build==0.13.6"]
41
+ build-backend = "uv_build"
42
+
43
+ [tool.uv]
44
+ exclude-newer = "2026-10-30T00:00:00Z"
45
+
46
+ [tool.uv.build-backend]
47
+ module-name = "crosscheck"
@@ -0,0 +1,39 @@
1
+ [project]
2
+ name = "crosscheck-vision"
3
+ version = "0.1.0"
4
+ description = "Several local vision models describe a photo; hear where they agree and where they disagree. For blind and low-vision users."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ authors = [{ name = "Rush Labs", email = "admin@rushlabs.ai" }]
10
+ keywords = ["accessibility", "blind", "low-vision", "image-description", "ollama", "vision-language-model"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Environment :: Web Environment",
14
+ "Intended Audience :: End Users/Desktop",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3",
17
+ "Topic :: Adaptive Technologies",
18
+ ]
19
+ # No runtime dependencies: the standard library only.
20
+ dependencies = []
21
+
22
+ [project.scripts]
23
+ crosscheck = "crosscheck.cli:main"
24
+
25
+ [project.urls]
26
+ Homepage = "https://rushlabs.ai/lab"
27
+ Source = "https://github.com/rushlabs-ai/crosscheck"
28
+ Issues = "https://github.com/rushlabs-ai/crosscheck/issues"
29
+
30
+ [build-system]
31
+ # Exact pin, at least 7 days old when chosen (supply-chain policy).
32
+ requires = ["uv_build==0.13.6"]
33
+ build-backend = "uv_build"
34
+
35
+ [tool.uv]
36
+ exclude-newer = "2026-10-30T00:00:00Z"
37
+
38
+ [tool.uv.build-backend]
39
+ module-name = "crosscheck"
@@ -0,0 +1,3 @@
1
+ """Crosscheck: several local vision models describe a photo; hear where they agree."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,120 @@
1
+ """Command line: `crosscheck serve` (the web app) and `crosscheck describe PHOTO`."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import os
8
+ import sys
9
+ import webbrowser
10
+ from pathlib import Path
11
+
12
+ from . import __version__
13
+ from .images import ImageError, check_image
14
+ from .ollama import DEFAULT_URL, Ollama, OllamaError
15
+ from .pipeline import run
16
+
17
+ # Three model families, so their mistakes are less likely to be shared. All run on a 12-16 GB GPU
18
+ # one at a time (Ollama swaps them), or on a CPU, slowly.
19
+ DEFAULT_MODELS = ["qwen3-vl:4b-instruct", "gemma4:e4b", "granite3.2-vision:2b"]
20
+
21
+
22
+ def _models(arg: str | None) -> list[str]:
23
+ raw = arg or os.environ.get("CROSSCHECK_MODELS") or ",".join(DEFAULT_MODELS)
24
+ models = [m.strip() for m in raw.split(",") if m.strip()]
25
+ return list(dict.fromkeys(models))
26
+
27
+
28
+ def _check_installed(client: Ollama, models: list[str]) -> int:
29
+ try:
30
+ have = client.installed()
31
+ except OllamaError as e:
32
+ print(f"crosscheck: {e}. Start Ollama first (https://ollama.com).", file=sys.stderr)
33
+ return 2
34
+ missing = [m for m in models if m not in have]
35
+ if missing:
36
+ print("crosscheck: these models are not in Ollama yet:", file=sys.stderr)
37
+ for m in missing:
38
+ print(f" ollama pull {m}", file=sys.stderr)
39
+ return 2
40
+ if len(models) < 2:
41
+ print("crosscheck: note: with one model nothing can be cross-checked.", file=sys.stderr)
42
+ return 0
43
+
44
+
45
+ def cmd_serve(args: argparse.Namespace) -> int:
46
+ from .server import serve
47
+
48
+ client = Ollama(args.ollama)
49
+ models = _models(args.models)
50
+ if (code := _check_installed(client, models)) != 0:
51
+ return code
52
+ httpd = serve(client, models, args.port)
53
+ url = f"http://127.0.0.1:{httpd.server_address[1]}/"
54
+ print(f"Crosscheck is running at {url} with {', '.join(models)}. Press Ctrl+C to stop.")
55
+ if not args.no_browser:
56
+ webbrowser.open(url)
57
+ try:
58
+ httpd.serve_forever()
59
+ except KeyboardInterrupt:
60
+ pass
61
+ return 0
62
+
63
+
64
+ def cmd_describe(args: argparse.Namespace) -> int:
65
+ client = Ollama(args.ollama)
66
+ models = _models(args.models)
67
+ try:
68
+ image = check_image(Path(args.photo).read_bytes())
69
+ except (OSError, ImageError) as e:
70
+ print(f"crosscheck: {e}", file=sys.stderr)
71
+ return 2
72
+ if (code := _check_installed(client, models)) != 0:
73
+ return code
74
+ progress = None if args.json else (lambda msg: print(msg, file=sys.stderr))
75
+ result = run(client, image, models, args.question or "", progress=progress)
76
+ if args.json:
77
+ print(json.dumps(result.to_dict(), indent=2, ensure_ascii=False))
78
+ return 0
79
+ data = result.to_dict()
80
+ print(result.spoken)
81
+ for key, title in (("disputed", "Where the models disagree"), ("agreed", "What every model agrees on"),
82
+ ("unconfirmed", "Details not every model could judge")):
83
+ if data[key]:
84
+ print(f"\n{title}:")
85
+ for f in data[key]:
86
+ print(f"- {f['text']}")
87
+ if key == "disputed":
88
+ print(" " + "; ".join(f"{m}: {j}" for m, j in f["judgements"].items()))
89
+ return 0
90
+
91
+
92
+ def build_parser() -> argparse.ArgumentParser:
93
+ p = argparse.ArgumentParser(prog="crosscheck", description="Several local vision models describe a photo; "
94
+ "hear where they agree and where they disagree.")
95
+ p.add_argument("--version", action="version", version=f"crosscheck {__version__}")
96
+ common = argparse.ArgumentParser(add_help=False)
97
+ common.add_argument("--ollama", default=os.environ.get("CROSSCHECK_OLLAMA", DEFAULT_URL), help="Ollama URL")
98
+ common.add_argument("--models", help=f"comma-separated Ollama models (default: {','.join(DEFAULT_MODELS)})")
99
+ sub = p.add_subparsers(dest="command", required=True)
100
+ s = sub.add_parser("serve", parents=[common], help="Start the web app on 127.0.0.1")
101
+ s.add_argument("--port", type=int, default=8765)
102
+ s.add_argument("--no-browser", action="store_true", help="Do not open a browser")
103
+ s.set_defaults(func=cmd_serve)
104
+ d = sub.add_parser("describe", parents=[common], help="Check one photo in the terminal")
105
+ d.add_argument("photo")
106
+ d.add_argument("--question", help="What you want to know, e.g. 'What does the label say?'")
107
+ d.add_argument("--json", action="store_true", help="Print the full result as JSON")
108
+ d.set_defaults(func=cmd_describe)
109
+ return p
110
+
111
+
112
+ def main(argv: list[str] | None = None) -> int:
113
+ args = build_parser().parse_args(argv)
114
+ try:
115
+ return args.func(args)
116
+ except OllamaError as e:
117
+ print(f"crosscheck: {e}", file=sys.stderr)
118
+ return 1
119
+ except KeyboardInterrupt:
120
+ return 130