12 lines
435 B
Python
12 lines
435 B
Python
def extract_embedding(audio_path):
|
|
signal = MODEL.load_audio(audio_path)
|
|
if isinstance(signal, tuple):
|
|
signal = signal[0]
|
|
signal = signal.unsqueeze(0).to(DEVICE)
|
|
with torch.no_grad():
|
|
emb = MODEL.encode_batch(signal)
|
|
return emb.squeeze().cpu().numpy().tolist()
|
|
|
|
def verify_speakers(audio_path, ref_path):
|
|
score, pred = MODEL.verify_files(audio_path, ref_path)
|
|
return float(score), bool(pred) |