Baghdad99 commited on
Commit
1f03166
1 Parent(s): 6b1800d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
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(translated_text)
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