Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

1.5 KB
Raw Blame
from __future__ import annotations

import importlib.metadata as metadata
import json
import sys
import argparse

from . import PROTOCOL, SERVICE_VERSION
from .config import ServiceConfig
from .resources import assert_punkt_tab


def main() -> None:
    if not ((3, 10) <= sys.version_info[:2] < (3, 14)):
        raise RuntimeError(f"WhisperX service requires Python >=3.10,<3.14; got {sys.version.split()[0]}")
    parser = argparse.ArgumentParser()
    parser.add_argument("--models", action="store_true", help="Check selected cached models without downloading")
    arguments = parser.parse_args()
    config = ServiceConfig.from_environment()
    assert_punkt_tab(config.nltk_data_root)
    import numpy  # noqa: F401
    import whisperx

    for name in ("load_model", "load_align_model", "align"):
        if not callable(getattr(whisperx, name, None)):
            raise RuntimeError(f"installed WhisperX is missing required API: {name}")
    versions = {
        name: metadata.version(name)
        for name in ("hypit-whisperx-service", "whisperx", "faster-whisper", "numpy", "torch")
    }
    if versions["whisperx"] != "3.8.6":
        raise RuntimeError(f"expected whisperx 3.8.6, got {versions['whisperx']}")
    if arguments.models:
        from .models import check_models
        check_models(config)
    print(json.dumps({
        "ok": True,
        "protocol": PROTOCOL,
        "serviceVersion": SERVICE_VERSION,
        "python": sys.version.split()[0],
        "packages": versions,
    }, sort_keys=True))