1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2025-01-23 17:52:54 +02:00
LibreTranslate/scripts/install_models.py

22 lines
744 B
Python
Raw Normal View History

2020-12-20 11:55:56 -05:00
#!/usr/bin/env python
import os
2023-07-09 12:29:11 +02:00
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import argparse
2023-07-09 12:29:11 +02:00
from libretranslate.init import check_and_install_models
2020-12-19 17:40:37 -05:00
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--load_only_lang_codes", type=str, default="")
parser.add_argument("--update", action='store_true')
args = parser.parse_args()
2022-04-01 10:01:15 -04:00
lang_codes = args.load_only_lang_codes.split(",")
2022-04-01 10:06:03 -04:00
if len(lang_codes) == 0 or lang_codes[0] == '':
2022-04-01 10:01:15 -04:00
lang_codes = None
if args.update:
check_and_install_models(update=True, load_only_lang_codes=lang_codes)
else:
check_and_install_models(force=True, load_only_lang_codes=lang_codes)