Update app.py
Browse files
app.py
CHANGED
@@ -30,8 +30,11 @@ def translate_speech(audio):
|
|
30 |
# Use the translation pipeline to translate the transcription
|
31 |
translated_text = translator(transcription, return_tensors="pt")
|
32 |
|
|
|
|
|
|
|
33 |
# Use the text-to-speech pipeline to synthesize the translated text
|
34 |
-
synthesised_speech = tts(
|
35 |
|
36 |
# Define the max_range variable
|
37 |
max_range = 32767 # You can adjust this value based on your requirements
|
|
|
30 |
# Use the translation pipeline to translate the transcription
|
31 |
translated_text = translator(transcription, return_tensors="pt")
|
32 |
|
33 |
+
# Convert the tensor to a string
|
34 |
+
translated_text_str = translated_text[0]['generated_text']
|
35 |
+
|
36 |
# Use the text-to-speech pipeline to synthesize the translated text
|
37 |
+
synthesised_speech = tts(translated_text_str)
|
38 |
|
39 |
# Define the max_range variable
|
40 |
max_range = 32767 # You can adjust this value based on your requirements
|