Spaces:
Build error
Build error
Commit
·
09b2c6d
1
Parent(s):
0ce7006
Update app.py
Browse files
app.py
CHANGED
@@ -8,12 +8,10 @@ import os
|
|
8 |
import numpy as np
|
9 |
|
10 |
def translate_speech_to_speech(input_audio):
|
11 |
-
# Convert stereo audio to mono
|
12 |
-
mono_audio = np.mean(input_audio, axis=1)
|
13 |
|
14 |
# Save the input audio to a temporary file
|
15 |
input_file = "input_audio.wav"
|
16 |
-
sf.write(input_file,
|
17 |
|
18 |
# Language detection and translation code from the first code snippet
|
19 |
model = whisper.load_model("base")
|
@@ -50,8 +48,8 @@ def translate_speech_to_speech(input_audio):
|
|
50 |
|
51 |
title = "Speech-to-Speech Translator"
|
52 |
|
53 |
-
input_audio = gr.inputs.Audio(source="microphone"
|
54 |
-
output_audio = gr.outputs.Audio(
|
55 |
|
56 |
stt_demo = gr.Interface(
|
57 |
fn=translate_speech_to_speech,
|
|
|
8 |
import numpy as np
|
9 |
|
10 |
def translate_speech_to_speech(input_audio):
|
|
|
|
|
11 |
|
12 |
# Save the input audio to a temporary file
|
13 |
input_file = "input_audio.wav"
|
14 |
+
sf.write(input_file, input_audio, 44100)
|
15 |
|
16 |
# Language detection and translation code from the first code snippet
|
17 |
model = whisper.load_model("base")
|
|
|
48 |
|
49 |
title = "Speech-to-Speech Translator"
|
50 |
|
51 |
+
input_audio = gr.inputs.Audio(source="microphone")
|
52 |
+
output_audio = gr.outputs.Audio()
|
53 |
|
54 |
stt_demo = gr.Interface(
|
55 |
fn=translate_speech_to_speech,
|