Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
| 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"]
|