Hunzla commited on
Commit
aac73e4
1 Parent(s): e94a1ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -31,14 +31,12 @@ def find_most_similar_command(statement, command_list):
31
  return best_match,reply
32
  def transcribe_the_command(audio):
33
  import soundfile as sf
34
- print(audio)
35
  file_name = "recorded_audio.wav"
36
- audio_data = audio[0]
37
-
38
  # Convert stereo to mono by averaging the two channels
39
- mono_audio = (audio_data[:, 0] + audio_data[:, 1]) / 2
40
- print(mono_audio)
41
- sf.write(file_name, mono_audio, 48000)
42
  transcript = asr_pipe(file_name)["text"]
43
  most_similar_command,reply = find_most_similar_command(transcript, commands)
44
  print(f"Given Statement: {transcript}")
 
31
  return best_match,reply
32
  def transcribe_the_command(audio):
33
  import soundfile as sf
34
+ sample_rate, audio_data = audio
35
  file_name = "recorded_audio.wav"
36
+ sf.write(file_name, audio_data, sample_rate)
 
37
  # Convert stereo to mono by averaging the two channels
38
+ print(file_name)
39
+
 
40
  transcript = asr_pipe(file_name)["text"]
41
  most_similar_command,reply = find_most_similar_command(transcript, commands)
42
  print(f"Given Statement: {transcript}")