Siddhant commited on
Commit
55d576a
1 Parent(s): 526631a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -166,6 +166,7 @@ def transcribe(stream, new_chunk):
166
  global audio_output
167
  global vad_output
168
 
 
169
  audio_int16 = np.frombuffer(y, dtype=np.int16)
170
  audio_float32 = int2float(audio_int16)
171
  audio_float32=librosa.resample(audio_float32, orig_sr=sr, target_sr=16000)
@@ -185,7 +186,7 @@ def transcribe(stream, new_chunk):
185
  vad.set_mode(3)
186
  if (vad.is_speech(y[i*960:(i+1)*960].tobytes(), orig_sr)):
187
  vad_count+=1
188
- if vad_count>10:
189
  vad_curr=True
190
  if vad_output is None:
191
  vad_output=[torch.from_numpy(audio_float32)]
 
166
  global audio_output
167
  global vad_output
168
 
169
+ orig_sr=sr
170
  audio_int16 = np.frombuffer(y, dtype=np.int16)
171
  audio_float32 = int2float(audio_int16)
172
  audio_float32=librosa.resample(audio_float32, orig_sr=sr, target_sr=16000)
 
186
  vad.set_mode(3)
187
  if (vad.is_speech(y[i*960:(i+1)*960].tobytes(), orig_sr)):
188
  vad_count+=1
189
+ if vad_count>5:
190
  vad_curr=True
191
  if vad_output is None:
192
  vad_output=[torch.from_numpy(audio_float32)]