Changes to google translate
Browse files
app.py
CHANGED
@@ -57,10 +57,10 @@ def create_segments(audio_fpath, seconds_max):
|
|
57 |
return segment_paths, segment_start_times
|
58 |
|
59 |
def get_translation(text):
|
60 |
-
translator = Translator()
|
61 |
-
|
62 |
-
|
63 |
-
return
|
64 |
|
65 |
#translation_pipeline = pipeline("translation", model=model, tokenizer=tokenizer, src_lang=src_lang, tgt_lang=tgt_lang, max_length=400, device=device)
|
66 |
#result = translation_pipeline(text)
|
|
|
57 |
return segment_paths, segment_start_times
|
58 |
|
59 |
def get_translation(text):
|
60 |
+
translator = Translator(service_urls=['translate.googleapis.com'])
|
61 |
+
translated_text = translator.translate(text, lang_tgt="en").text
|
62 |
+
|
63 |
+
return translated_text
|
64 |
|
65 |
#translation_pipeline = pipeline("translation", model=model, tokenizer=tokenizer, src_lang=src_lang, tgt_lang=tgt_lang, max_length=400, device=device)
|
66 |
#result = translation_pipeline(text)
|