Suya OCR API — vLLM-backed, OpenAI-compatible OCR service

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>
This commit is contained in:
Fu Dai
2026-06-17 10:20:02 +04:00
co-authored by Claude Opus 4.8
commit 1a585693be
147 changed files with 13827 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
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)