Update custom_interface.py
Browse files- custom_interface.py +3 -3
custom_interface.py
CHANGED
@@ -107,15 +107,15 @@ class ASR(Pretrained):
|
|
107 |
# Get audio length in seconds
|
108 |
audio_length = len(waveform) / sr
|
109 |
|
110 |
-
if audio_length >=
|
111 |
print(f"Audio is too long ({audio_length:.2f} seconds), splitting into segments")
|
112 |
# Detect non-silent segments
|
113 |
-
non_silent_intervals = librosa.effects.split(waveform, top_db=
|
114 |
|
115 |
segments = []
|
116 |
current_segment = []
|
117 |
current_length = 0
|
118 |
-
max_duration =
|
119 |
|
120 |
for interval in non_silent_intervals:
|
121 |
start, end = interval
|
|
|
107 |
# Get audio length in seconds
|
108 |
audio_length = len(waveform) / sr
|
109 |
|
110 |
+
if audio_length >= 10:
|
111 |
print(f"Audio is too long ({audio_length:.2f} seconds), splitting into segments")
|
112 |
# Detect non-silent segments
|
113 |
+
non_silent_intervals = librosa.effects.split(waveform, top_db=20) # Adjust top_db for sensitivity
|
114 |
|
115 |
segments = []
|
116 |
current_segment = []
|
117 |
current_length = 0
|
118 |
+
max_duration = 10 * sr # Maximum segment duration in samples (10 seconds)
|
119 |
|
120 |
for interval in non_silent_intervals:
|
121 |
start, end = interval
|