FastAPI service wrapping the Surya-OCR-2 model (datalab-to) served through vLLM: legacy /v1/api/ai/* endpoints, an OpenAI-compatible /v1/chat/completions endpoint, a coalescing request batcher, a local OCR CLI, Docker packaging, multilingual example outputs, and quantization/concurrency benchmarks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
856 B
Python
30 lines
856 B
Python
from pathlib import Path
|
|
|
|
from scripts.quant.manifest import load_manifest
|
|
|
|
|
|
def test_load_manifest_skips_blanks_and_comments(tmp_path):
|
|
repo = tmp_path / "repo"
|
|
repo.mkdir()
|
|
(repo / "a.png").write_bytes(b"x")
|
|
(repo / "b.jpg").write_bytes(b"y")
|
|
manifest = tmp_path / "manifest.txt"
|
|
manifest.write_text("# header\n\na.png\nb.jpg\n", encoding="utf-8")
|
|
|
|
result = load_manifest(manifest, repo)
|
|
|
|
assert result == [repo / "a.png", repo / "b.jpg"]
|
|
|
|
|
|
def test_load_manifest_raises_on_missing_image(tmp_path):
|
|
repo = tmp_path / "repo"
|
|
repo.mkdir()
|
|
manifest = tmp_path / "manifest.txt"
|
|
manifest.write_text("missing.png\n", encoding="utf-8")
|
|
|
|
try:
|
|
load_manifest(manifest, repo)
|
|
assert False, "expected FileNotFoundError"
|
|
except FileNotFoundError as exc:
|
|
assert "missing.png" in str(exc)
|