Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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(
|
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)
|