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 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app.py') 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') -- cgit v1.2.3