Update modules/translation/translation_base.py
Browse files
modules/translation/translation_base.py
CHANGED
@@ -6,7 +6,7 @@ import gc
|
|
6 |
from typing import List
|
7 |
from datetime import datetime
|
8 |
|
9 |
-
|
10 |
from modules.utils.subtitle_manager import *
|
11 |
from modules.utils.files_manager import load_yaml, save_yaml
|
12 |
from modules.utils.paths import DEFAULT_PARAMETERS_CONFIG_PATH, NLLB_MODELS_DIR, TRANSLATION_OUTPUT_DIR
|
@@ -225,8 +225,8 @@ class TranslationBase(ABC):
|
|
225 |
max_length: int,
|
226 |
add_timestamp: bool):
|
227 |
def validate_lang(lang: str):
|
228 |
-
if lang in list(
|
229 |
-
flipped = {value: key for key, value in
|
230 |
return flipped[lang]
|
231 |
return lang
|
232 |
|
|
|
6 |
from typing import List
|
7 |
from datetime import datetime
|
8 |
|
9 |
+
import modules.translation.nllb_inference as nllb
|
10 |
from modules.utils.subtitle_manager import *
|
11 |
from modules.utils.files_manager import load_yaml, save_yaml
|
12 |
from modules.utils.paths import DEFAULT_PARAMETERS_CONFIG_PATH, NLLB_MODELS_DIR, TRANSLATION_OUTPUT_DIR
|
|
|
225 |
max_length: int,
|
226 |
add_timestamp: bool):
|
227 |
def validate_lang(lang: str):
|
228 |
+
if lang in list(nllb.NLLB_AVAILABLE_LANGS.values()):
|
229 |
+
flipped = {value: key for key, value in nllb.NLLB_AVAILABLE_LANGS.items()}
|
230 |
return flipped[lang]
|
231 |
return lang
|
232 |
|