anzorq commited on
Commit
d22f729
·
verified ·
1 Parent(s): 8e25cf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -42,6 +42,10 @@ def transcribe_streaming(stream, new_chunk):
42
  audio_data = audio_data.astype(np.float32)
43
  audio_data /= np.max(np.abs(audio_data))
44
 
 
 
 
 
45
  if stream is not None:
46
  stream = np.concatenate([stream, audio_data])
47
  else:
 
42
  audio_data = audio_data.astype(np.float32)
43
  audio_data /= np.max(np.abs(audio_data))
44
 
45
+ # Convert audio data to mono if it has multiple channels
46
+ if audio_data.ndim > 1:
47
+ audio_data = np.mean(audio_data, axis=1)
48
+
49
  if stream is not None:
50
  stream = np.concatenate([stream, audio_data])
51
  else: