Add logging to diarization
This commit is contained in:
parent
a79f825f66
commit
56d7406a31
1 changed files with 2 additions and 3 deletions
|
@ -20,15 +20,14 @@ class TxtTranscription:
|
||||||
def diarize(audiofile: Path, pipeline: Pipeline, output_path: Path) -> Path:
|
def diarize(audiofile: Path, pipeline: Pipeline, output_path: Path) -> Path:
|
||||||
audiofile_prepended = _add_audio_silence(audiofile)
|
audiofile_prepended = _add_audio_silence(audiofile)
|
||||||
|
|
||||||
|
logging.info(f"Beginning diarization of {audiofile}...")
|
||||||
DIARIZE_FILE = {"uri": "not-important", "audio": audiofile_prepended}
|
DIARIZE_FILE = {"uri": "not-important", "audio": audiofile_prepended}
|
||||||
dz = pipeline(DIARIZE_FILE)
|
dz = pipeline(DIARIZE_FILE)
|
||||||
|
|
||||||
out_file = Path.joinpath(output_path, "diarization.txt")
|
out_file = Path.joinpath(output_path, "diarization.txt")
|
||||||
with open(out_file, "w") as text_file:
|
with open(out_file, "w") as text_file:
|
||||||
text_file.write(str(dz))
|
text_file.write(str(dz))
|
||||||
|
logging.info(f"Created diarization in {out_file}.")
|
||||||
print("Diarized:")
|
|
||||||
print(*list(dz.itertracks(yield_label=True))[:10], sep="\n")
|
|
||||||
|
|
||||||
return out_file
|
return out_file
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue