Hunzla commited on
Commit
ba51995
1 Parent(s): 6d3db2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -32,7 +32,10 @@ def find_most_similar_command(statement, command_list):
32
  def transcribe_the_command(audio):
33
  import soundfile as sf
34
  file_name = "recorded_audio.wav"
35
- mono_audio = (audio[:, 0] + audio[:, 1]) / 2
 
 
 
36
  print(mono_audio)
37
  sf.write(file_name, mono_audio, 48000)
38
  transcript = asr_pipe(file_name)["text"]
 
32
  def transcribe_the_command(audio):
33
  import soundfile as sf
34
  file_name = "recorded_audio.wav"
35
+ audio_data = audio[0]
36
+
37
+ # Convert stereo to mono by averaging the two channels
38
+ mono_audio = (audio_data[:, 0] + audio_data[:, 1]) / 2
39
  print(mono_audio)
40
  sf.write(file_name, mono_audio, 48000)
41
  transcript = asr_pipe(file_name)["text"]