crosscheck-vision 0.1.0__py3-none-any.whl

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.
crosscheck/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """Crosscheck: several local vision models describe a photo; hear where they agree."""
2
+
3
+ __version__ = "0.1.0"
crosscheck/__main__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
crosscheck/cli.py ADDED
@@ -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
crosscheck/images.py ADDED
@@ -0,0 +1,27 @@
1
+ """Image checks without third-party packages."""
2
+
3
+ from __future__ import annotations
4
+
5
+ MAX_IMAGE = 20 * 1024 * 1024
6
+
7
+
8
+ class ImageError(ValueError):
9
+ pass
10
+
11
+
12
+ def kind(data: bytes) -> str | None:
13
+ if data[:3] == b"\xff\xd8\xff":
14
+ return "jpeg"
15
+ if data[:8] == b"\x89PNG\r\n\x1a\n":
16
+ return "png"
17
+ return None
18
+
19
+
20
+ def check_image(data: bytes) -> bytes:
21
+ if not data:
22
+ raise ImageError("no photo received")
23
+ if len(data) > MAX_IMAGE:
24
+ raise ImageError("the photo is too large (20 MB at most)")
25
+ if kind(data) is None:
26
+ raise ImageError("use a JPEG or PNG photo")
27
+ return data
crosscheck/ollama.py ADDED
@@ -0,0 +1,78 @@
1
+ """A minimal Ollama client: chat with an image and a JSON schema. Standard library only."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import base64
6
+ import json
7
+ import urllib.error
8
+ import urllib.request
9
+ from dataclasses import dataclass
10
+ from typing import Any
11
+
12
+ DEFAULT_URL = "http://127.0.0.1:11434"
13
+
14
+
15
+ class OllamaError(Exception):
16
+ def __init__(self, message: str, status: int = 0):
17
+ super().__init__(message)
18
+ self.status = status
19
+
20
+
21
+ @dataclass
22
+ class Ollama:
23
+ url: str = DEFAULT_URL
24
+ timeout: float = 600.0
25
+
26
+ def _call(self, method: str, path: str, body: dict[str, Any] | None = None) -> Any:
27
+ data = json.dumps(body).encode() if body is not None else None
28
+ req = urllib.request.Request(self.url.rstrip("/") + path, data=data, method=method,
29
+ headers={"Content-Type": "application/json"})
30
+ try:
31
+ with urllib.request.urlopen(req, timeout=self.timeout) as resp:
32
+ return json.loads(resp.read() or b"null")
33
+ except urllib.error.HTTPError as e:
34
+ text = e.read().decode("utf-8", "replace")
35
+ try:
36
+ text = json.loads(text).get("error") or text
37
+ except (ValueError, AttributeError):
38
+ pass
39
+ raise OllamaError(str(text)[:300], e.code) from None
40
+ except (urllib.error.URLError, TimeoutError, ConnectionError) as e:
41
+ raise OllamaError(f"cannot reach Ollama at {self.url} ({getattr(e, 'reason', e)})") from None
42
+
43
+ def installed(self) -> set[str]:
44
+ """Model names Ollama has, with and without the ':latest' tag."""
45
+ names: set[str] = set()
46
+ for m in (self._call("GET", "/api/tags") or {}).get("models") or []:
47
+ name = m.get("name") or m.get("model") or ""
48
+ names.add(name)
49
+ if name.endswith(":latest"):
50
+ names.add(name[: -len(":latest")])
51
+ return names
52
+
53
+ def chat_json(self, model: str, prompt: str, image: bytes, schema: dict[str, Any]) -> tuple[Any, dict[str, Any]]:
54
+ """Ask about an image; returns (parsed JSON answer, timing info)."""
55
+ body = {
56
+ "model": model,
57
+ "messages": [{"role": "user", "content": prompt, "images": [base64.b64encode(image).decode("ascii")]}],
58
+ "format": schema, # Ollama constrains the output to this JSON schema
59
+ "stream": False,
60
+ "think": False,
61
+ "options": {"temperature": 0},
62
+ }
63
+ last: Exception | None = None
64
+ for _ in range(2): # one retry if the answer does not parse
65
+ resp = self._call("POST", "/api/chat", body)
66
+ content = ((resp or {}).get("message") or {}).get("content") or ""
67
+ try:
68
+ parsed = json.loads(content)
69
+ except ValueError as e:
70
+ last = e
71
+ continue
72
+ timing = {
73
+ "seconds": round((resp.get("total_duration") or 0) / 1e9, 2),
74
+ "load_seconds": round((resp.get("load_duration") or 0) / 1e9, 2),
75
+ "output_tokens": resp.get("eval_count"),
76
+ }
77
+ return parsed, timing
78
+ raise OllamaError(f"{model} did not return valid JSON ({last})")
crosscheck/pipeline.py ADDED
@@ -0,0 +1,230 @@
1
+ """Describe a photo with several vision models and find where they agree.
2
+
3
+ 1. Each model lists what it sees as short, separate facts (structured JSON output).
4
+ 2. Facts that say the same thing are merged; facts that differ in a number or in
5
+ quoted text are kept apart, because that is exactly where errors hide.
6
+ 3. Every model judges every fact it did not state: yes, no, or unsure.
7
+ 4. A fact is "agreed" when every model says yes, "disputed" when any says no,
8
+ and "unconfirmed" otherwise.
9
+
10
+ Agreement is not proof: models can share a mistake. The wording never says
11
+ "verified" or "correct".
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import re
17
+ import time
18
+ import unicodedata
19
+ from collections import Counter
20
+ from dataclasses import dataclass, field
21
+ from typing import Any, Callable
22
+
23
+ from .ollama import Ollama, OllamaError
24
+
25
+ DESCRIBE_SCHEMA = {
26
+ "type": "object",
27
+ "properties": {
28
+ "summary": {"type": "string"},
29
+ "facts": {"type": "array", "items": {"type": "string"}, "maxItems": 15},
30
+ },
31
+ "required": ["summary", "facts"],
32
+ }
33
+
34
+ VERIFY_SCHEMA = {
35
+ "type": "object",
36
+ "properties": {
37
+ "answers": {
38
+ "type": "array",
39
+ "items": {
40
+ "type": "object",
41
+ "properties": {"n": {"type": "integer"}, "answer": {"type": "string", "enum": ["yes", "no", "unsure"]}},
42
+ "required": ["n", "answer"],
43
+ },
44
+ }
45
+ },
46
+ "required": ["answers"],
47
+ }
48
+
49
+ DESCRIBE_PROMPT = """You are helping a blind person understand a photo they took.{question}
50
+ List what you can see as short, separate facts, one fact per item. Start with the most important:
51
+ what the main object or scene is, and any text you can read, quoted exactly. Include colours,
52
+ positions, quantities and anything that matters for safety. Only state what is visible. If
53
+ something is unclear, blurry or cut off, say so in the fact instead of guessing.
54
+ Also write a one-sentence summary."""
55
+
56
+ VERIFY_PROMPT = """Another assistant described this photo with the numbered statements below. Look at the
57
+ photo yourself and judge each statement. Answer "yes" if the photo clearly shows it, "no" if the
58
+ photo shows something different, and "unsure" if you cannot tell from the photo.
59
+
60
+ {statements}"""
61
+
62
+ _WORD = re.compile(r"\w+", re.UNICODE)
63
+ _NUMBER = re.compile(r"\d+(?:[.,]\d+)?")
64
+ _QUOTED = re.compile(r"[\"“”'‘’«»]([^\"“”'‘’«»]{2,})[\"“”'‘’«»]")
65
+
66
+
67
+ def _norm(text: str) -> str:
68
+ return unicodedata.normalize("NFKC", text).casefold()
69
+
70
+
71
+ def _f1(a: str, b: str) -> float:
72
+ x, y = _WORD.findall(_norm(a)), _WORD.findall(_norm(b))
73
+ if not x or not y:
74
+ return 0.0
75
+ common = sum((Counter(x) & Counter(y)).values())
76
+ if not common:
77
+ return 0.0
78
+ p, r = common / len(y), common / len(x)
79
+ return 2 * p * r / (p + r)
80
+
81
+
82
+ def _anchors(text: str) -> tuple[frozenset[str], frozenset[str]]:
83
+ t = _norm(text)
84
+ return frozenset(_NUMBER.findall(t)), frozenset(q.strip() for q in _QUOTED.findall(t))
85
+
86
+
87
+ def same_fact(a: str, b: str, threshold: float = 0.6) -> bool:
88
+ """Near-duplicates only if numbers and quoted text match too."""
89
+ return _anchors(a) == _anchors(b) and _f1(a, b) >= threshold
90
+
91
+
92
+ @dataclass
93
+ class Fact:
94
+ text: str
95
+ sources: list[str] # models that stated it
96
+ votes: dict[str, str] = field(default_factory=dict) # model -> yes/no/unsure
97
+
98
+ def status(self, models: list[str]) -> str:
99
+ answers = [("yes" if m in self.sources else self.votes.get(m, "unsure")) for m in models]
100
+ if "no" in answers:
101
+ return "disputed"
102
+ if all(a == "yes" for a in answers):
103
+ return "agreed"
104
+ return "unconfirmed"
105
+
106
+
107
+ @dataclass
108
+ class Result:
109
+ models: list[str]
110
+ summary: str
111
+ spoken: str
112
+ facts: list[Fact]
113
+ descriptions: dict[str, dict[str, Any]]
114
+ failed: dict[str, str]
115
+ seconds: float
116
+
117
+ def to_dict(self) -> dict[str, Any]:
118
+ groups: dict[str, list[dict[str, Any]]] = {"agreed": [], "disputed": [], "unconfirmed": []}
119
+ for f in self.facts:
120
+ groups[f.status(self.models)].append({
121
+ "text": f.text,
122
+ "stated_by": f.sources,
123
+ "judgements": {m: ("stated it" if m in f.sources else f.votes.get(m, "no answer")) for m in self.models},
124
+ })
125
+ return {"models": self.models, "summary": self.summary, "spoken": self.spoken, **groups,
126
+ "descriptions": self.descriptions, "failed": self.failed, "seconds": self.seconds}
127
+
128
+
129
+ Progress = Callable[[str], None]
130
+
131
+
132
+ def _short(text: str, limit: int = 90) -> str:
133
+ text = text.strip().rstrip(".")
134
+ return text if len(text) <= limit else text[: limit - 1].rsplit(" ", 1)[0] + "…"
135
+
136
+
137
+ def spoken_summary(summary: str, facts: list[Fact], models: list[str], failed: dict[str, str]) -> str:
138
+ agreed = [f for f in facts if f.status(models) == "agreed"]
139
+ disputed = [f for f in facts if f.status(models) == "disputed"]
140
+ parts = [summary.strip().rstrip(".") + "."] if summary.strip() else []
141
+ if len(models) < 2:
142
+ parts.append("Only one model answered, so nothing could be cross-checked.")
143
+ else:
144
+ parts.append(f"The {len(models)} models agree on {len(agreed)} of {len(facts)} details.")
145
+ if disputed:
146
+ listed = "; ".join(_short(f.text) for f in disputed[:3])
147
+ more = f", and {len(disputed) - 3} more" if len(disputed) > 3 else ""
148
+ parts.append(f"They disagree about: {listed}{more}.")
149
+ else:
150
+ parts.append("No model contradicted another.")
151
+ if failed:
152
+ parts.append(f"{len(failed)} model{'s' if len(failed) > 1 else ''} did not answer.")
153
+ return " ".join(parts)
154
+
155
+
156
+ def run(client: Ollama, image: bytes, models: list[str], question: str = "",
157
+ progress: Progress | None = None) -> Result:
158
+ started = time.monotonic()
159
+ say = progress or (lambda _msg: None)
160
+ q = f"\nThe person asks: {question.strip()}\nAnswer that first, then describe the rest." if question.strip() else ""
161
+ descriptions: dict[str, dict[str, Any]] = {}
162
+ failed: dict[str, str] = {}
163
+
164
+ for i, model in enumerate(models, start=1):
165
+ say(f"Model {i} of {len(models)} is describing the photo.")
166
+ try:
167
+ out, timing = client.chat_json(model, DESCRIBE_PROMPT.format(question=q), image, DESCRIBE_SCHEMA)
168
+ except OllamaError as e:
169
+ failed[model] = str(e)
170
+ continue
171
+ facts = [str(x).strip() for x in (out.get("facts") or []) if str(x).strip()][:15]
172
+ descriptions[model] = {"summary": str(out.get("summary") or "").strip(), "facts": facts, **timing}
173
+
174
+ answered = [m for m in models if m in descriptions]
175
+ merged: list[Fact] = []
176
+ for model in answered:
177
+ for text in descriptions[model]["facts"]:
178
+ match = next((f for f in merged if same_fact(f.text, text)), None)
179
+ if match:
180
+ if model not in match.sources:
181
+ match.sources.append(model)
182
+ else:
183
+ merged.append(Fact(text=text, sources=[model]))
184
+
185
+ if len(answered) > 1:
186
+ # Judge in reverse order so the model loaded last goes first (fewer model swaps).
187
+ for i, model in enumerate(reversed(answered), start=1):
188
+ todo = [f for f in merged if model not in f.sources]
189
+ if not todo:
190
+ continue
191
+ say(f"Model {i} of {len(answered)} is checking the other models' details.")
192
+ statements = "\n".join(f"{n}. {f.text}" for n, f in enumerate(todo, start=1))
193
+ try:
194
+ out, timing = client.chat_json(model, VERIFY_PROMPT.format(statements=statements), image, VERIFY_SCHEMA)
195
+ except OllamaError as e:
196
+ failed[model] = f"while checking: {e}"
197
+ continue
198
+ descriptions[model]["check_seconds"] = timing["seconds"]
199
+ for a in out.get("answers") or []:
200
+ try:
201
+ n = int(a.get("n"))
202
+ except (TypeError, ValueError):
203
+ continue
204
+ if 1 <= n <= len(todo) and a.get("answer") in ("yes", "no", "unsure"):
205
+ todo[n - 1].votes[model] = a["answer"]
206
+
207
+ order = {"disputed": 0, "agreed": 1, "unconfirmed": 2}
208
+ merged.sort(key=lambda f: order[f.status(answered)])
209
+ summary = _best_summary(descriptions, merged, answered)
210
+ return Result(
211
+ models=answered,
212
+ summary=summary,
213
+ spoken=spoken_summary(summary, merged, answered, failed) if answered else
214
+ "No model could describe the photo. " + "; ".join(f"{m}: {e}" for m, e in failed.items()),
215
+ facts=merged,
216
+ descriptions=descriptions,
217
+ failed=failed,
218
+ seconds=round(time.monotonic() - started, 1),
219
+ )
220
+
221
+
222
+ def _best_summary(descriptions: dict[str, dict[str, Any]], facts: list[Fact], models: list[str]) -> str:
223
+ """The summary from the model whose own facts the others agreed with most."""
224
+ best, best_score = "", -1.0
225
+ for m in models:
226
+ own = [f for f in facts if m in f.sources]
227
+ score = sum(1 for f in own if f.status(models) == "agreed") / max(1, len(own))
228
+ if score > best_score and descriptions[m]["summary"]:
229
+ best, best_score = descriptions[m]["summary"], score
230
+ return best
crosscheck/server.py ADDED
@@ -0,0 +1,197 @@
1
+ """The local web app: upload a photo, hear where the models agree.
2
+
3
+ Runs on 127.0.0.1 only. Requests must carry a local Host header (no DNS rebinding)
4
+ and, for POSTs, a same-origin Origin (no cross-site requests). Photos stay in
5
+ memory and go only to your Ollama.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import base64
11
+ import binascii
12
+ import json
13
+ import secrets
14
+ import threading
15
+ import time
16
+ from collections import OrderedDict
17
+ from http import HTTPStatus
18
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
19
+ from importlib import resources
20
+ from queue import Queue
21
+ from typing import Any
22
+ from urllib.parse import urlsplit
23
+
24
+ from . import __version__
25
+ from .images import ImageError, check_image
26
+ from .ollama import Ollama
27
+ from .pipeline import run
28
+
29
+ MAX_BODY = 25 * 1024 * 1024
30
+ MAX_JOBS = 20
31
+ JOB_TTL = 30 * 60
32
+ STATIC = {"/": ("index.html", "text/html; charset=utf-8"),
33
+ "/app.js": ("app.js", "text/javascript; charset=utf-8"),
34
+ "/app.css": ("app.css", "text/css; charset=utf-8")}
35
+ CSP = ("default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' blob: data:; connect-src 'self'; "
36
+ "form-action 'self'; base-uri 'none'; frame-ancestors 'none'")
37
+ LOCAL_HOSTS = ("localhost", "127.0.0.1", "[::1]")
38
+
39
+
40
+ class Jobs:
41
+ """Photos are checked one at a time (the GPU is the bottleneck)."""
42
+
43
+ def __init__(self, client: Ollama, models: list[str]):
44
+ self.client, self.models = client, models
45
+ self.jobs: OrderedDict[str, dict[str, Any]] = OrderedDict()
46
+ self.lock = threading.Lock()
47
+ self.queue: Queue[str] = Queue()
48
+ threading.Thread(target=self._worker, daemon=True).start()
49
+
50
+ def submit(self, image: bytes, question: str) -> str | None:
51
+ with self.lock:
52
+ self._expire()
53
+ if sum(1 for j in self.jobs.values() if j["state"] in ("queued", "running")) >= MAX_JOBS:
54
+ return None
55
+ job_id = secrets.token_urlsafe(12)
56
+ self.jobs[job_id] = {"state": "queued", "message": "Waiting for the previous photo to finish.",
57
+ "created": time.time(), "image": image, "question": question}
58
+ self.queue.put(job_id)
59
+ return job_id
60
+
61
+ def get(self, job_id: str) -> dict[str, Any] | None:
62
+ with self.lock:
63
+ job = self.jobs.get(job_id)
64
+ if job is None:
65
+ return None
66
+ out = {k: v for k, v in job.items() if k not in ("image", "question", "created")}
67
+ if job["state"] == "queued":
68
+ ahead = 0
69
+ for jid, j in self.jobs.items():
70
+ if jid == job_id:
71
+ break
72
+ if j["state"] in ("queued", "running"):
73
+ ahead += 1
74
+ out["ahead"] = ahead
75
+ return out
76
+
77
+ def _expire(self) -> None:
78
+ now = time.time()
79
+ for jid in [j for j, v in self.jobs.items() if now - v["created"] > JOB_TTL and v["state"] in ("done", "error")]:
80
+ del self.jobs[jid]
81
+
82
+ def _set(self, job_id: str, **kw: Any) -> None:
83
+ with self.lock:
84
+ if job_id in self.jobs:
85
+ self.jobs[job_id].update(kw)
86
+
87
+ def _worker(self) -> None:
88
+ while True:
89
+ job_id = self.queue.get()
90
+ with self.lock:
91
+ job = self.jobs.get(job_id)
92
+ if not job:
93
+ continue
94
+ image, question = job.pop("image"), job.pop("question")
95
+ self._set(job_id, state="running", message="Starting.")
96
+ try:
97
+ result = run(self.client, image, self.models, question,
98
+ progress=lambda msg: self._set(job_id, message=msg))
99
+ self._set(job_id, state="done", message="Done.", result=result.to_dict())
100
+ except Exception as e: # report, never crash the worker
101
+ self._set(job_id, state="error", message=f"Something went wrong: {e}")
102
+
103
+
104
+ def make_handler(jobs: Jobs, port: int):
105
+ allowed_hosts = {f"{h}:{port}" for h in LOCAL_HOSTS}
106
+ allowed_origins = {f"http://{h}" for h in allowed_hosts}
107
+
108
+ class Handler(BaseHTTPRequestHandler):
109
+ server_version = f"crosscheck/{__version__}"
110
+ sys_version = ""
111
+
112
+ def log_message(self, fmt: str, *args: Any) -> None: # no photo data or questions in logs
113
+ pass
114
+
115
+ def _send(self, status: int, body: bytes, ctype: str = "application/json") -> None:
116
+ self.send_response(status)
117
+ self.send_header("Content-Type", ctype)
118
+ self.send_header("Content-Length", str(len(body)))
119
+ self.send_header("Content-Security-Policy", CSP)
120
+ self.send_header("X-Content-Type-Options", "nosniff")
121
+ self.send_header("Referrer-Policy", "no-referrer")
122
+ self.send_header("Cache-Control", "no-store")
123
+ self.end_headers()
124
+ self.wfile.write(body)
125
+
126
+ def _json(self, status: int, obj: Any) -> None:
127
+ self._send(status, json.dumps(obj).encode())
128
+
129
+ def _host_ok(self) -> bool:
130
+ if self.headers.get("Host", "") not in allowed_hosts:
131
+ self._json(HTTPStatus.FORBIDDEN, {"error": "host not allowed"})
132
+ return False
133
+ return True
134
+
135
+ def do_GET(self) -> None:
136
+ if not self._host_ok():
137
+ return
138
+ path = urlsplit(self.path).path
139
+ if path in STATIC:
140
+ name, ctype = STATIC[path]
141
+ self._send(HTTPStatus.OK, (resources.files("crosscheck") / "static" / name).read_bytes(), ctype)
142
+ elif path.startswith("/api/jobs/"):
143
+ job = jobs.get(path.rsplit("/", 1)[-1])
144
+ self._json(HTTPStatus.OK if job else HTTPStatus.NOT_FOUND, job or {"error": "unknown job"})
145
+ elif path == "/api/info":
146
+ self._json(HTTPStatus.OK, {"models": jobs.models, "version": __version__})
147
+ else:
148
+ self._json(HTTPStatus.NOT_FOUND, {"error": "not found"})
149
+
150
+ def do_POST(self) -> None:
151
+ if not self._host_ok():
152
+ return
153
+ origin = self.headers.get("Origin")
154
+ if origin is not None and origin not in allowed_origins:
155
+ self._json(HTTPStatus.FORBIDDEN, {"error": "cross-origin request refused"})
156
+ return
157
+ if urlsplit(self.path).path != "/api/check":
158
+ self._json(HTTPStatus.NOT_FOUND, {"error": "not found"})
159
+ return
160
+ if "application/json" not in (self.headers.get("Content-Type") or ""):
161
+ self._json(HTTPStatus.UNSUPPORTED_MEDIA_TYPE, {"error": "send JSON"})
162
+ return
163
+ try:
164
+ length = int(self.headers.get("Content-Length") or 0)
165
+ except ValueError:
166
+ length = -1
167
+ if length <= 0 or length > MAX_BODY:
168
+ self._json(HTTPStatus.REQUEST_ENTITY_TOO_LARGE, {"error": "the photo is too large (25 MB at most)"})
169
+ return
170
+ try:
171
+ body = json.loads(self.rfile.read(length))
172
+ data = str(body.get("image") or "")
173
+ if data.startswith("data:"):
174
+ data = data.split(",", 1)[-1]
175
+ image = check_image(base64.b64decode(data, validate=True))
176
+ question = str(body.get("question") or "")[:500]
177
+ except ImageError as e: # a ValueError too, so it comes first
178
+ self._json(HTTPStatus.BAD_REQUEST, {"error": str(e)})
179
+ return
180
+ except (ValueError, AttributeError, binascii.Error):
181
+ self._json(HTTPStatus.BAD_REQUEST, {"error": "expected JSON with a base64 image"})
182
+ return
183
+ job_id = jobs.submit(image, question)
184
+ if job_id is None:
185
+ self._json(HTTPStatus.TOO_MANY_REQUESTS, {"error": "too many photos waiting; try again shortly"})
186
+ return
187
+ self._json(HTTPStatus.ACCEPTED, {"job": job_id})
188
+
189
+ return Handler
190
+
191
+
192
+ def serve(client: Ollama, models: list[str], port: int = 8765) -> ThreadingHTTPServer:
193
+ jobs = Jobs(client, models)
194
+ httpd = ThreadingHTTPServer(("127.0.0.1", port), make_handler(jobs, port))
195
+ if port == 0: # tests: bind first, then learn the port
196
+ httpd.RequestHandlerClass = make_handler(jobs, httpd.server_address[1])
197
+ return httpd
@@ -0,0 +1,57 @@
1
+ :root {
2
+ color-scheme: light dark;
3
+ --bg: #ffffff;
4
+ --fg: #111111;
5
+ --muted: #3d3d3d;
6
+ --line: #8a8a8a;
7
+ --accent: #0b4fb3;
8
+ --focus: #b35900;
9
+ --surface: #f2f2f2;
10
+ }
11
+ @media (prefers-color-scheme: dark) {
12
+ :root {
13
+ --bg: #111111;
14
+ --fg: #f5f5f5;
15
+ --muted: #d0d0d0;
16
+ --line: #8a8a8a;
17
+ --accent: #8fb8ff;
18
+ --focus: #ffb366;
19
+ --surface: #1f1f1f;
20
+ }
21
+ }
22
+ * { box-sizing: border-box; }
23
+ html { font-size: 112.5%; }
24
+ body { margin: 0; background: var(--bg); color: var(--fg); font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
25
+ main { max-width: 46rem; margin: 0 auto; padding: 2rem 1rem 4rem; }
26
+ h1 { font-size: 2rem; margin: 0 0 .25rem; }
27
+ h2 { font-size: 1.5rem; margin: 2rem 0 .5rem; }
28
+ h3 { font-size: 1.15rem; margin: 1.5rem 0 .25rem; }
29
+ h4 { font-size: 1rem; margin: 1rem 0 .25rem; }
30
+ .lead { color: var(--muted); margin-top: 0; }
31
+ .field { margin: 1.25rem 0; }
32
+ .field label { display: block; font-weight: 600; margin-bottom: .25rem; }
33
+ .field.check { display: flex; gap: .6rem; align-items: center; }
34
+ .field.check label { margin: 0; font-weight: 400; }
35
+ .optional, .help { color: var(--muted); font-weight: 400; }
36
+ .help { margin: .25rem 0 0; font-size: .9rem; }
37
+ input[type="text"], input[type="file"] {
38
+ width: 100%; font: inherit; color: inherit; background: var(--bg);
39
+ border: 2px solid var(--line); border-radius: 6px; padding: .6rem .7rem;
40
+ }
41
+ input[type="checkbox"] { width: 1.3rem; height: 1.3rem; accent-color: var(--accent); }
42
+ button {
43
+ font: inherit; font-weight: 600; color: var(--bg); background: var(--accent);
44
+ border: 0; border-radius: 6px; padding: .8rem 1.4rem; cursor: pointer; min-height: 48px;
45
+ }
46
+ button:disabled { opacity: .6; cursor: progress; }
47
+ :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
48
+ #status { min-height: 1.6em; font-weight: 600; margin: 1.5rem 0 0; }
49
+ #result { margin-top: 1rem; }
50
+ #result:focus { outline: none; }
51
+ .spoken { font-size: 1.15rem; background: var(--surface); border-left: 4px solid var(--accent); padding: .8rem 1rem; }
52
+ ul { padding-left: 1.25rem; }
53
+ li { margin: .35rem 0; }
54
+ .who { color: var(--muted); font-size: .9rem; }
55
+ details { margin-top: 1.5rem; border: 2px solid var(--line); border-radius: 6px; padding: .5rem 1rem; }
56
+ summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
57
+ .note { margin-top: 3rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 1rem; }
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+
3
+ // Everything from the server is inserted with textContent, never as HTML.
4
+ const $ = (id) => document.getElementById(id);
5
+ const MAX_SIDE = 1600;
6
+
7
+ function setStatus(text) {
8
+ const el = $("status");
9
+ if (el.textContent !== text) el.textContent = text; // repeat nothing to screen readers
10
+ }
11
+
12
+ // Downscale and re-encode as JPEG in the browser: smaller uploads, and the photo's
13
+ // metadata (such as GPS location) is dropped.
14
+ async function preparePhoto(file) {
15
+ let bitmap;
16
+ try {
17
+ bitmap = await createImageBitmap(file, { imageOrientation: "from-image" });
18
+ } catch {
19
+ throw new Error("This browser cannot open that photo. Try a JPEG or PNG.");
20
+ }
21
+ const scale = Math.min(1, MAX_SIDE / Math.max(bitmap.width, bitmap.height));
22
+ const canvas = document.createElement("canvas");
23
+ canvas.width = Math.round(bitmap.width * scale);
24
+ canvas.height = Math.round(bitmap.height * scale);
25
+ canvas.getContext("2d").drawImage(bitmap, 0, 0, canvas.width, canvas.height);
26
+ const blob = await new Promise((resolve) => canvas.toBlob(resolve, "image/jpeg", 0.9));
27
+ return await new Promise((resolve, reject) => {
28
+ const reader = new FileReader();
29
+ reader.onload = () => resolve(reader.result);
30
+ reader.onerror = () => reject(new Error("Could not read the photo."));
31
+ reader.readAsDataURL(blob);
32
+ });
33
+ }
34
+
35
+ function fillList(id, items, models) {
36
+ const list = $(id);
37
+ list.replaceChildren();
38
+ const heading = $(id + "-heading");
39
+ if (!items.length) {
40
+ const li = document.createElement("li");
41
+ li.textContent = "None.";
42
+ list.append(li);
43
+ return;
44
+ }
45
+ for (const item of items) {
46
+ const li = document.createElement("li");
47
+ const text = document.createElement("span");
48
+ text.className = "fact";
49
+ text.textContent = item.text;
50
+ li.append(text);
51
+ if (models.length > 1) {
52
+ const who = document.createElement("span");
53
+ who.className = "who";
54
+ who.textContent = " (" + models.map((m) => m + ": " + item.judgements[m]).join("; ") + ")";
55
+ li.append(who);
56
+ }
57
+ list.append(li);
58
+ }
59
+ heading.textContent = heading.textContent.replace(/ \(\d+\)$/, "") + " (" + items.length + ")";
60
+ }
61
+
62
+ function showResult(result) {
63
+ $("spoken").textContent = result.spoken;
64
+ fillList("disputed", result.disputed, result.models);
65
+ fillList("agreed", result.agreed, result.models);
66
+ fillList("unconfirmed", result.unconfirmed, result.models);
67
+ const box = $("descriptions");
68
+ box.replaceChildren();
69
+ for (const [model, d] of Object.entries(result.descriptions)) {
70
+ const h = document.createElement("h4");
71
+ h.textContent = model;
72
+ const p = document.createElement("p");
73
+ p.textContent = d.summary;
74
+ const ul = document.createElement("ul");
75
+ for (const f of d.facts) {
76
+ const li = document.createElement("li");
77
+ li.textContent = f;
78
+ ul.append(li);
79
+ }
80
+ box.append(h, p, ul);
81
+ }
82
+ for (const [model, err] of Object.entries(result.failed)) {
83
+ const p = document.createElement("p");
84
+ p.textContent = model + " did not answer: " + err;
85
+ box.append(p);
86
+ }
87
+ $("timing").textContent = result.seconds < 1 ? "Took under a second." : "Took " + Math.round(result.seconds) + " seconds.";
88
+ const section = $("result");
89
+ section.hidden = false;
90
+ section.focus(); // screen readers start at the result
91
+ if ($("speak").checked && "speechSynthesis" in window) {
92
+ const utterance = new SpeechSynthesisUtterance(result.spoken);
93
+ const local = speechSynthesis.getVoices().find((v) => v.localService && v.lang.startsWith(document.documentElement.lang));
94
+ if (local) utterance.voice = local; // prefer a voice that runs on this device
95
+ speechSynthesis.cancel();
96
+ speechSynthesis.speak(utterance);
97
+ }
98
+ }
99
+
100
+ async function poll(job) {
101
+ for (;;) {
102
+ await new Promise((r) => setTimeout(r, 1000));
103
+ const resp = await fetch("/api/jobs/" + encodeURIComponent(job));
104
+ const data = await resp.json();
105
+ if (data.state === "done") return data.result;
106
+ if (data.state === "error" || !resp.ok) throw new Error(data.message || data.error || "Something went wrong.");
107
+ setStatus(data.state === "queued" && data.ahead ? `Waiting: ${data.ahead} photo(s) ahead.` : data.message);
108
+ }
109
+ }
110
+
111
+ async function onSubmit(event) {
112
+ event.preventDefault();
113
+ const file = $("photo").files[0];
114
+ if (!file) {
115
+ setStatus("Choose a photo first.");
116
+ $("photo").focus();
117
+ return;
118
+ }
119
+ const button = $("submit");
120
+ button.disabled = true;
121
+ $("result").hidden = true;
122
+ try {
123
+ setStatus("Preparing the photo.");
124
+ const image = await preparePhoto(file);
125
+ setStatus("Sending the photo to the models. This can take a minute.");
126
+ const resp = await fetch("/api/check", {
127
+ method: "POST",
128
+ headers: { "Content-Type": "application/json" },
129
+ body: JSON.stringify({ image, question: $("question").value }),
130
+ });
131
+ const data = await resp.json();
132
+ if (!resp.ok) throw new Error(data.error || "The photo was not accepted.");
133
+ const result = await poll(data.job);
134
+ setStatus("Result ready.");
135
+ showResult(result);
136
+ } catch (err) {
137
+ setStatus(err.message);
138
+ } finally {
139
+ button.disabled = false;
140
+ }
141
+ }
142
+
143
+ document.addEventListener("DOMContentLoaded", () => {
144
+ $("form").addEventListener("submit", onSubmit);
145
+ });
@@ -0,0 +1,62 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="color-scheme" content="light dark">
7
+ <title>Crosscheck</title>
8
+ <meta name="description" content="Several local vision models describe a photo; hear where they agree and where they disagree.">
9
+ <link rel="stylesheet" href="/app.css">
10
+ <script src="/app.js" defer></script>
11
+ </head>
12
+ <body>
13
+ <main>
14
+ <h1>Crosscheck</h1>
15
+ <p class="lead">Several AI models describe your photo. You hear what they agree on, and where they disagree.</p>
16
+
17
+ <form id="form" novalidate>
18
+ <div class="field">
19
+ <label for="photo">Photo</label>
20
+ <input id="photo" name="photo" type="file" accept="image/jpeg,image/png,image/*" aria-describedby="photo-help">
21
+ <p id="photo-help" class="help">JPEG or PNG. The photo stays on this computer.</p>
22
+ </div>
23
+ <div class="field">
24
+ <label for="question">Question <span class="optional">(optional)</span></label>
25
+ <input id="question" name="question" type="text" maxlength="500" autocomplete="off"
26
+ aria-describedby="question-help">
27
+ <p id="question-help" class="help">For example: What does the label say?</p>
28
+ </div>
29
+ <div class="field check">
30
+ <input id="speak" type="checkbox">
31
+ <label for="speak">Also read the result aloud with this browser's voice</label>
32
+ </div>
33
+ <button id="submit" type="submit">Check photo</button>
34
+ </form>
35
+
36
+ <p id="status" role="status" aria-live="polite" aria-atomic="true"></p>
37
+
38
+ <section id="result" tabindex="-1" aria-labelledby="result-heading" hidden>
39
+ <h2 id="result-heading">Result</h2>
40
+ <p id="spoken" class="spoken"></p>
41
+
42
+ <h3 id="disputed-heading">Where the models disagree</h3>
43
+ <ul id="disputed" aria-labelledby="disputed-heading"></ul>
44
+
45
+ <h3 id="agreed-heading">What every model agrees on</h3>
46
+ <ul id="agreed" aria-labelledby="agreed-heading"></ul>
47
+
48
+ <h3 id="unconfirmed-heading">Details not every model could judge</h3>
49
+ <ul id="unconfirmed" aria-labelledby="unconfirmed-heading"></ul>
50
+
51
+ <details>
52
+ <summary>Each model's own description</summary>
53
+ <div id="descriptions"></div>
54
+ </details>
55
+ <p id="timing" class="help"></p>
56
+ </section>
57
+
58
+ <p class="note">Agreement is not proof: models can make the same mistake. For anything that matters,
59
+ such as medicine, money or safety, confirm with a person or another trusted source.</p>
60
+ </main>
61
+ </body>
62
+ </html>
@@ -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,15 @@
1
+ crosscheck/__init__.py,sha256=ABDA4N3bHyLAMg-QTV0r9FD6hSgNvNAS3TJ5dRQxVro,110
2
+ crosscheck/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
3
+ crosscheck/cli.py,sha256=079hZJob6HVfWrYrQqWc5SWUKopD9JflBcx3_N5UnA4,4748
4
+ crosscheck/images.py,sha256=DvcXcW08cxxtzHwRY42wJO1Ng53Uop5sjISiU3S6UoQ,627
5
+ crosscheck/ollama.py,sha256=Q94TAb9N_hd23xY508hASUpfpM1tXPDy1RHy2omPgdg,3221
6
+ crosscheck/pipeline.py,sha256=rSz21xfK2-SAo52D-8d21wj8zbMIuip0mLlcX0BVVgg,9267
7
+ crosscheck/server.py,sha256=Bn6TfRaQzVjTLwzPlqU5n2UqxMRRvp3oY_-hC4Q08Bw,8408
8
+ crosscheck/static/app.css,sha256=bFbwy6yYUqVkItB2MFLmS84jJmZHHIGj0VpfoKSL-Z8,2438
9
+ crosscheck/static/app.js,sha256=A6eRXogALkCmlmmTnqb3PL2dJfgbQVGX9zSeKQVrnKA,5250
10
+ crosscheck/static/index.html,sha256=aTi9-F1pwlm486to17hKacAypSjQhdRE_bk5ZQai6rg,2472
11
+ crosscheck_vision-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
12
+ crosscheck_vision-0.1.0.dist-info/WHEEL,sha256=3NO1oYsF7mANFUWVdyEQLM-zmecczWWEmmF5rEbXrWk,80
13
+ crosscheck_vision-0.1.0.dist-info/entry_points.txt,sha256=TZzklRC2lXr7w-j3cAP7IUMKSZnpHLy0MyTIHkZwXcA,52
14
+ crosscheck_vision-0.1.0.dist-info/METADATA,sha256=vqiE5eiir9hYewCvzWzYBPgQGsKNIapJv5gFU98T3dc,5615
15
+ crosscheck_vision-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.13.6
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ crosscheck = crosscheck.cli:main
3
+
@@ -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.