File size: 1,150 Bytes
688378c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Smoke-тест Audit: сборка весов (если нужно) + транскрибация примера.

Запуск:
    python tests/smoke_test.py
"""

from __future__ import annotations

import subprocess
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))

from audio_audit import AuditEngine  # noqa: E402

JFK = ROOT / "examples" / "jfk.wav"


def main() -> int:
    model_bin = ROOT / "model" / "model.bin"
    if not model_bin.exists():
        print("Веса не найдены — собираю scripts/build_model.py ...")
        subprocess.run([sys.executable, str(ROOT / "scripts" / "build_model.py")], check=True)

    engine = AuditEngine()
    result = engine.transcribe(JFK, language="en")
    text = result["text"].lower()
    print("Расшифровка:", result["text"])

    assert result["language"] == "en"
    for needle in ("fellow americans", "ask not what your country"):
        assert needle in text, f"В расшифровке нет «{needle}»"
    print("SMOKE TEST OK")
    return 0


if __name__ == "__main__":
    sys.exit(main())