Commit
·
262c6d5
1
Parent(s):
48d7752
trying without chunks
Browse files
app.py
CHANGED
@@ -86,17 +86,18 @@ def process_video(date):
|
|
86 |
|
87 |
# Split the audio into chunks
|
88 |
audio = AudioSegment.from_wav(audio_path)
|
89 |
-
chunks = split_on_silence(audio, min_silence_len=500, silence_thresh=-40)
|
90 |
-
|
91 |
-
# Transcribe each chunk
|
92 |
-
transcription = ""
|
93 |
-
for i, chunk in enumerate(chunks):
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
100 |
# Remove the audio file
|
101 |
os.remove(audio_path)
|
102 |
except:
|
|
|
86 |
|
87 |
# Split the audio into chunks
|
88 |
audio = AudioSegment.from_wav(audio_path)
|
89 |
+
# chunks = split_on_silence(audio, min_silence_len=500, silence_thresh=-40)
|
90 |
+
|
91 |
+
# # Transcribe each chunk
|
92 |
+
# transcription = ""
|
93 |
+
# for i, chunk in enumerate(chunks):
|
94 |
+
# chunk.export(f"chunk{i}.wav", format="wav")
|
95 |
+
# with open(f"chunk{i}.wav", "rb") as audio_file:
|
96 |
+
# audio = audio_file.read()
|
97 |
+
# transcription += pipe(audio)["text"] + " "
|
98 |
+
# os.remove(f"chunk{i}.wav")
|
99 |
+
|
100 |
+
transcription = pipe(audio)["text"]
|
101 |
# Remove the audio file
|
102 |
os.remove(audio_path)
|
103 |
except:
|