save transcript
This commit is contained in:
parent
5fdd753e90
commit
6df2d95b1c
9
app.py
9
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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user