Hi, my code looks like this:
import soundfile as sf
from pyannote.audio import Inference
import numpy as np
from scipy.spatial.distance import cdist
inference = Inference(model, window="whole")
sampling_rate = 48000
new_column = ["voice_print"] * len(tmp_set)
tmp_set = tmp_set.add_column("voice_print", new_column)
print(tmp_set)
speaker = "tmp"
for sample in en_set:
if speaker == sample["client_id"]:
continue
speaker = sample["client_id"]
audio_data = sample["audio"]["array"]
sf.write('test.wav', audio_data, sampling_rate, format='WAV', subtype='PCM_16')
embedding = inference('test.wav')
new_item = {
'client_id': sample["client_id"],
'voice_print': embedding
}
print(new_item)
tmp_set = tmp_set.add_item(new_item)
printing new item show correct values in my variables but adding new item ends with this error:
ArrowInvalid: cannot construct ChunkedArray from empty vector and omitted type
I used this way of adding items several times and it worked. Do you have any idea what could be wrong? Thank you.