Baghdad99 commited on
Commit
a5ec736
1 Parent(s): 99295a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -12,8 +12,11 @@ tts = pipeline("text-to-speech", model="Baghdad99/english_voice_tts")
12
 
13
  # Define the function to translate speech
14
  def translate_speech(audio):
 
 
 
15
  # Use the speech recognition pipeline to transcribe the audio
16
- transcription = pipe(audio)[0]["transcription"]
17
 
18
  # Use the translation pipeline to translate the transcription
19
  translated_text = translator(transcription, return_tensors="pt", padding=True)
@@ -27,6 +30,7 @@ def translate_speech(audio):
27
 
28
  return 16000, synthesised_speech
29
 
 
30
  # Define the Gradio interface
31
  iface = gr.Interface(
32
  fn=translate_speech,
 
12
 
13
  # Define the function to translate speech
14
  def translate_speech(audio):
15
+ # Extract the audio data from the tuple
16
+ audio_data = audio[0]
17
+
18
  # Use the speech recognition pipeline to transcribe the audio
19
+ transcription = pipe(audio_data)["transcription"]
20
 
21
  # Use the translation pipeline to translate the transcription
22
  translated_text = translator(transcription, return_tensors="pt", padding=True)
 
30
 
31
  return 16000, synthesised_speech
32
 
33
+
34
  # Define the Gradio interface
35
  iface = gr.Interface(
36
  fn=translate_speech,