From 6df2d95b1c0fd9b39771dac5514b51b657facdc0 Mon Sep 17 00:00:00 2001 From: Xaloc Date: Wed, 4 Oct 2023 16:48:18 +0200 Subject: [PATCH] save transcript --- app.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index bb0e834..cffd86b 100644 --- a/app.py +++ b/app.py @@ -32,7 +32,9 @@ def large_audio(path, minutes=5): os.mkdir(folder_name) whole_text = "" print("Starting transcription") + total_chunks = len(chunks) for i, audio_chunk in enumerate(chunks, start=1): + print(f"Chunk {i} of {total_chunks}") # export audio chunk and save it in # the `folder_name` directory. chunk_filename = os.path.join(folder_name, f"chunk{i}.wav") @@ -44,10 +46,13 @@ def large_audio(path, minutes=5): print("Error:", str(e)) else: text = f"{text.capitalize()}. " - print(chunk_filename, ":", text) + # print(chunk_filename, ":", text) whole_text += text # return the text for all chunks detected return whole_text if __name__=="__main__": - print(large_audio(fname)) + text = large_audio(fname) + fname = "transcript.txt" + with open(fname, 'w') as f: + f.writeline(text)