Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -58,9 +58,9 @@ def transcribe(file, return_timestamps=False):
|
|
58 |
waveform, sample_rate = torchaudio.load(file)
|
59 |
audio_duration = waveform.size(1) / sample_rate
|
60 |
|
61 |
-
if audio_duration >
|
62 |
# Trim the waveform to the first 30 minutes
|
63 |
-
waveform = waveform[:, :int(
|
64 |
truncated_file = "truncated_audio.wav"
|
65 |
torchaudio.save(truncated_file, waveform, sample_rate)
|
66 |
file_to_transcribe = truncated_file
|
|
|
58 |
waveform, sample_rate = torchaudio.load(file)
|
59 |
audio_duration = waveform.size(1) / sample_rate
|
60 |
|
61 |
+
if audio_duration > max_audio_length:
|
62 |
# Trim the waveform to the first 30 minutes
|
63 |
+
waveform = waveform[:, :int(max_audio_length * sample_rate)]
|
64 |
truncated_file = "truncated_audio.wav"
|
65 |
torchaudio.save(truncated_file, waveform, sample_rate)
|
66 |
file_to_transcribe = truncated_file
|