From 89e9376820e7e817b7d0052e28e973d423715811 Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 26 Dec 2023 20:08:17 -0800 Subject: Statically link curation TUI Also include it in the package. --- app.py | 9 ++++++++- curate/Makefile | 2 +- pkg/package.ps1 | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 21fbbf7..87be1d2 100644 --- a/app.py +++ b/app.py @@ -578,18 +578,21 @@ def stopApp(): def transcribeAudio(concatenated_path: str): # Step 1: Install Whisper requirements + print("Installing Whisper dependencies, this will take several minutes") with open("whisper_requirements.txt", "r") as file: requirements = file.read().splitlines() if not pipInstall(requirements): return # Step 2: Iterate over .wav files in the current working directory + print("Loading Whisper model, this will take several minutes") whisper = Whisper(None) for wav_file in os.listdir('.'): if wav_file.endswith('.wav'): if wav_file.endswith(os.path.basename(concatenated_path)): print("Skipping concatenated file") continue + # Step 3: Transcription pipeline # TODO parameterize high fidelity framerate print(f"Transcribing {wav_file}") @@ -597,11 +600,15 @@ def transcribeAudio(concatenated_path: str): collector = CompressingAudioCollector(AudioCollector(disk_stream)) whisper.collector = collector + transcript_filename = wav_file.replace('.wav', '.txt') + if os.path.exists(transcript_filename): + print(f"Transcript already exists - skipping") + continue + # Transcribe the audio segments = whisper.transcribe() # Step 4: Save transcriptions - transcript_filename = wav_file.replace('.wav', '.txt') with open(transcript_filename, 'w') as txt_file: for segment in segments: txt_file.write(segment.transcript + '\n') diff --git a/curate/Makefile b/curate/Makefile index d4e63dc..d8e32f8 100644 --- a/curate/Makefile +++ b/curate/Makefile @@ -1,6 +1,6 @@ CC=g++ CFLAGS=-c -O2 -std=c++20 -LDFLAGS=-lcurses +LDFLAGS=-lcurses -ltinfo -static EXE=ui SRCS=ui.cc diff --git a/pkg/package.ps1 b/pkg/package.ps1 index 694cdea..3ba0568 100644 --- a/pkg/package.ps1 +++ b/pkg/package.ps1 @@ -70,11 +70,18 @@ if (-Not (Test-Path "silero-vad")) { git clone "https://github.com/snakers4/silero-vad" } +if (-Not (Test-Path "../curate/ui")) { + pushd ../curate/ui >$null + make + popd >$null +} + mkdir $install_dir > $null mkdir $install_dir/Models cp ../*.py $install_dir/ cp ../*.bat $install_dir/ cp ../*.txt $install_dir/ +cp ../curate/ui $install_dir/curation_tui_wsl cp -Recurse Python $install_dir/Python cp "silero-vad/files/silero_vad.onnx" $install_dir/Models/ cp "silero-vad/LICENSE" $install_dir/Models/silero_vad.onnx.LICENSE -- cgit v1.2.3