Spaces:
Sleeping
Sleeping
Update scripts/translate_summary.py
Browse files
scripts/translate_summary.py
CHANGED
|
@@ -1,13 +1,11 @@
|
|
| 1 |
-
from
|
| 2 |
|
| 3 |
class SummaryTranslator:
|
| 4 |
def __init__(self):
|
| 5 |
-
print("
|
| 6 |
-
self.translator = Translator()
|
| 7 |
-
print("Translator initialized.")
|
| 8 |
|
| 9 |
def translate_summary(self, text, dest_lang):
|
| 10 |
print(f"Translating summary to {dest_lang}...")
|
| 11 |
-
translation =
|
| 12 |
print("Translation completed.")
|
| 13 |
-
return translation
|
|
|
|
| 1 |
+
from deep_translator import GoogleTranslator
|
| 2 |
|
| 3 |
class SummaryTranslator:
|
| 4 |
def __init__(self):
|
| 5 |
+
print("Translator initialized using deep-translator.")
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def translate_summary(self, text, dest_lang):
|
| 8 |
print(f"Translating summary to {dest_lang}...")
|
| 9 |
+
translation = GoogleTranslator(source='auto', target=dest_lang).translate(text)
|
| 10 |
print("Translation completed.")
|
| 11 |
+
return translation
|