frogcho123 commited on
Commit
a96b473
1 Parent(s): 93f702e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -8,11 +8,12 @@ import os
8
  import numpy as np
9
 
10
  def translate_speech_to_speech(input_audio):
11
- if input_audio.ndim == 2:
12
- input_audio = np.mean(input_audio, axis=1)
13
- # Save the input audio to a temporary file
14
  input_file = "input_audio.wav"
15
- sf.write(input_file, input_audio, 16000)
 
16
 
17
  # Language detection and translation code from the first code snippet
18
  model = whisper.load_model("base")
 
8
  import numpy as np
9
 
10
  def translate_speech_to_speech(input_audio):
11
+ input_audio, sample_rate = input_tuple
12
+
13
+ # Save the input audio to a temporary file
14
  input_file = "input_audio.wav"
15
+ sf.write(input_file, input_audio, sample_rate) # use the sample rate from Gradio
16
+
17
 
18
  # Language detection and translation code from the first code snippet
19
  model = whisper.load_model("base")