ChristophSchuhmann's picture
Standalone VoiceCLAP-large-v2 genuineness predictor (bundled embedder + MLP head, val HTML)
04dc213 verified
Raw
History Blame Contribute Delete
944 Bytes
"""Minimal example: predict speech genuineness (0-6) for a wav file.
Usage:
python example.py path/to/clip.wav [full|balanced]
The model argument is optional and defaults to ``full`` (best overall MAE/corr).
Higher score = sounds more like a real, lived-in spoken moment; lower =
more rehearsed / synthetic.
"""
import os
import sys
from genuineness_scorer import GenuinenessScorer
def main():
if len(sys.argv) < 2:
print("usage: python example.py <clip.wav> [full|balanced]")
sys.exit(1)
wav_path = sys.argv[1]
model = sys.argv[2] if len(sys.argv) > 2 else "full"
pkg_dir = os.path.dirname(os.path.abspath(__file__))
import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
scorer = GenuinenessScorer(pkg_dir=pkg_dir, model=model, device=device)
score = scorer.score(wav_path)
print(f"[{model}] genuineness (0-6): {score:.3f}")
if __name__ == "__main__":
main()