Download smoke_test.py from openmodelai/Audit: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/openmodelai/Audit/resolve/main/smoke_test.py
- Command line
-
hf download hf://openmodelai/Audit/smoke_test.py
-
curl -L -o smoke_test.py https://huggingface.co/openmodelai/Audit/resolve/main/smoke_test.py
1.15 kB
| """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()) | |