helloWorld199 commited on
Commit
f1fd764
1 Parent(s): 60771a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -191,12 +191,13 @@ def add_voice_labelv2(json_file, audio_path):
191
 
192
  voice_idxs = np.where(np.array(speech_probs) >= 0.7)
193
  print(len(np.where(np.array(speech_probs) >= 0.7)))
 
194
  if len(voice_idxs) == 0:
195
  print("NO VOICE SEGMENTS DETECTED!")
196
  try:
197
  begin_seq = True
198
  start_idx = 0
199
-
200
  for i in range(len(voice_idxs)-1):
201
  if begin_seq:
202
  start_idx = voice_idxs[i]
@@ -213,15 +214,15 @@ def add_voice_labelv2(json_file, audio_path):
213
  end_seconds = (end_time - end_minutes) * 60
214
 
215
  print("modifying json data... \n")
216
- data['vocal_times'] = {
217
  "start_time": f"{start_minutes}.{start_seconds:.2f}",
218
  "end_time": f"{end_minutes}.{end_seconds:.2f}"
219
- }
220
 
221
  begin_seq = True
222
 
223
-
224
-
225
  except Exception as e:
226
  print(f"An exception occurred: {e}")
227
 
 
191
 
192
  voice_idxs = np.where(np.array(speech_probs) >= 0.7)
193
  print(len(np.where(np.array(speech_probs) >= 0.7)))
194
+
195
  if len(voice_idxs) == 0:
196
  print("NO VOICE SEGMENTS DETECTED!")
197
  try:
198
  begin_seq = True
199
  start_idx = 0
200
+ vocal_times=[]
201
  for i in range(len(voice_idxs)-1):
202
  if begin_seq:
203
  start_idx = voice_idxs[i]
 
214
  end_seconds = (end_time - end_minutes) * 60
215
 
216
  print("modifying json data... \n")
217
+ vocal_times.append( {
218
  "start_time": f"{start_minutes}.{start_seconds:.2f}",
219
  "end_time": f"{end_minutes}.{end_seconds:.2f}"
220
+ })
221
 
222
  begin_seq = True
223
 
224
+ data['vocal_times'] = vocal_times
225
+
226
  except Exception as e:
227
  print(f"An exception occurred: {e}")
228