Baghdad99 commited on
Commit
425531b
1 Parent(s): 5c4fa2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -13,8 +13,11 @@ tts = pipeline("text-to-speech", model="Baghdad99/english_voice_tts")
13
 
14
  # Define the function to translate speech
15
  def translate_speech(audio):
 
 
 
16
  # Use the speech recognition pipeline to transcribe the audio
17
- transcription = pipe(audio)["transcription"]
18
 
19
  # Use the translation pipeline to translate the transcription
20
  translated_text = translator(transcription, return_tensors="pt", padding=True)
 
13
 
14
  # Define the function to translate speech
15
  def translate_speech(audio):
16
+ # Separate the sample rate and the audio data
17
+ sample_rate, audio_data = audio
18
+
19
  # Use the speech recognition pipeline to transcribe the audio
20
+ transcription = pipe(audio_data)["transcription"]
21
 
22
  # Use the translation pipeline to translate the transcription
23
  translated_text = translator(transcription, return_tensors="pt", padding=True)