Spaces:
Running
Running
File size: 417 Bytes
e6b8403 fc97911 e6b8403 fc97911 e6b8403 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from tqdm import tqdm
from deep_translator import GoogleTranslator
def translate_text(segments, TRANSLATE_AUDIO_TO):
translator = GoogleTranslator(source='auto', target=TRANSLATE_AUDIO_TO)
for line in tqdm(range(len(segments))):
text = segments[line]['text']
translated_line = translator.translate(text.strip())
segments[line]['text'] = translated_line
return segments
|