fix white spaces in app.py

This commit is contained in:
Xaloc 2023-11-12 00:44:50 +01:00
parent 37e306257e
commit 0e96522cfd
1 changed files with 3 additions and 3 deletions

6
app.py
View File

@ -1,5 +1,5 @@
import speech_recognition as sr
import os
import os
from pydub import AudioSegment
from pydub.silence import split_on_silence
@ -21,13 +21,13 @@ def large_audio(path, minutes=5):
"""Splitting the large audio file into fixed interval chunks
and apply speech recognition on each of these chunks"""
print("Loading file")
sound = AudioSegment.from_file(path)
sound = AudioSegment.from_file(path)
print(len(sound))
print("Splitting file")
chunk_length_ms = int(1000 * 60 * minutes) # convert to milliseconds
chunks = [sound[i:i + chunk_length_ms] for i in range(0, len(sound), chunk_length_ms)]
folder_name = "audio-fixed-chunks"
if not os.path.isdir(folder_name):
os.mkdir(folder_name)
whole_text = ""