2020-12-20 16:55:56 +00:00
|
|
|
#!/usr/bin/env python
|
2023-01-13 15:21:07 +00:00
|
|
|
import os
|
2023-07-09 10:29:11 +00:00
|
|
|
import sys
|
|
|
|
|
2023-01-13 15:21:07 +00:00
|
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
2022-03-31 14:21:20 +00:00
|
|
|
import argparse
|
2023-07-09 10:29:11 +00:00
|
|
|
|
2022-12-29 23:44:53 +00:00
|
|
|
from libretranslate.init import check_and_install_models
|
2020-12-19 22:40:37 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-03-31 14:21:20 +00:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("--load_only_lang_codes", type=str, default="")
|
2023-09-29 20:43:59 +00:00
|
|
|
parser.add_argument("--update", action='store_true')
|
2022-03-31 14:21:20 +00:00
|
|
|
args = parser.parse_args()
|
2022-04-01 14:01:15 +00:00
|
|
|
lang_codes = args.load_only_lang_codes.split(",")
|
2022-04-01 14:06:03 +00:00
|
|
|
if len(lang_codes) == 0 or lang_codes[0] == '':
|
2022-04-01 14:01:15 +00:00
|
|
|
lang_codes = None
|
2023-09-29 20:43:59 +00:00
|
|
|
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)
|