Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -167,6 +167,10 @@ def aggregate_vocal_times(vocal_time):
|
|
| 167 |
return compressed_vocal_times
|
| 168 |
|
| 169 |
def add_voice_label(json_file, audio_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
# Load the JSON file
|
| 171 |
with open(json_file, 'r') as f:
|
| 172 |
data = json.load(f)
|
|
@@ -190,7 +194,7 @@ def add_voice_label(json_file, audio_path):
|
|
| 190 |
speech_probs.append(speech_prob)
|
| 191 |
vad_iterator.reset_states() # reset model states after each audio
|
| 192 |
|
| 193 |
-
voice_idxs = np.where(np.array(speech_probs) >=
|
| 194 |
print(len(voice_idxs))
|
| 195 |
|
| 196 |
if len(voice_idxs) == 0:
|
|
|
|
| 167 |
return compressed_vocal_times
|
| 168 |
|
| 169 |
def add_voice_label(json_file, audio_path):
|
| 170 |
+
# This is an hyperparameter of the model which determines wheter to consider
|
| 171 |
+
# the segment voice of non voice
|
| 172 |
+
THRESHOLD_PROBABILITY = 0.75
|
| 173 |
+
|
| 174 |
# Load the JSON file
|
| 175 |
with open(json_file, 'r') as f:
|
| 176 |
data = json.load(f)
|
|
|
|
| 194 |
speech_probs.append(speech_prob)
|
| 195 |
vad_iterator.reset_states() # reset model states after each audio
|
| 196 |
|
| 197 |
+
voice_idxs = np.where(np.array(speech_probs) >= THRESHOLD_PROBABILITY)[0]
|
| 198 |
print(len(voice_idxs))
|
| 199 |
|
| 200 |
if len(voice_idxs) == 0:
|