Spaces:
Sleeping
Sleeping
Update translator.py
Browse files- translator.py +2 -2
translator.py
CHANGED
@@ -21,7 +21,7 @@ class MangaTranslator:
|
|
21 |
Args:
|
22 |
text (str): The text to be translated.
|
23 |
method (str):"google" for Google Translator,
|
24 |
-
"hf" for Helsinki-NLP's opus-mt-ja-
|
25 |
"baidu" for Baidu Translate
|
26 |
"bing" for Microsoft Bing Translator
|
27 |
|
@@ -41,7 +41,7 @@ class MangaTranslator:
|
|
41 |
return translated_text if translated_text is not None else text
|
42 |
|
43 |
def _translate_with_hf(self, text):
|
44 |
-
pipe = pipeline("translation", model=f"Helsinki-NLP/opus-mt-ja-
|
45 |
translated_text = pipe(text)[0]["translation_text"]
|
46 |
return translated_text if translated_text is not None else text
|
47 |
|
|
|
21 |
Args:
|
22 |
text (str): The text to be translated.
|
23 |
method (str):"google" for Google Translator,
|
24 |
+
"hf" for Helsinki-NLP's opus-mt-ja-es model (HF pipeline)
|
25 |
"baidu" for Baidu Translate
|
26 |
"bing" for Microsoft Bing Translator
|
27 |
|
|
|
41 |
return translated_text if translated_text is not None else text
|
42 |
|
43 |
def _translate_with_hf(self, text):
|
44 |
+
pipe = pipeline("translation", model=f"Helsinki-NLP/opus-mt-ja-es")
|
45 |
translated_text = pipe(text)[0]["translation_text"]
|
46 |
return translated_text if translated_text is not None else text
|
47 |
|