From 1dddcea7940fc24ea1f68927da13bfc325fc7081 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 15 Jul 2022 12:12:20 -0400 Subject: [PATCH] Add --threads --- README.md | 1 + app/default_values.py | 5 +++++ app/main.py | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 581acee..8f1615d 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,7 @@ docker-compose -f docker-compose.cuda.yml up -d --build | --get-api-key-link | Show a link in the UI where to direct users to get an API key | `Don't show a link` | LT_GET_API_KEY_LINK | | --require-api-key-origin | Require use of an API key for programmatic access to the API, unless the request origin matches this domain | `No restrictions on domain origin` | LT_REQUIRE_API_KEY_ORIGIN | | --load-only | Set available languages | `all from argostranslate` | LT_LOAD_ONLY | +| --threads | Set number of threads | `4` | LT_THREADS | | --suggestions | Allow user suggestions | `false` | LT_SUGGESTIONS | | --disable-files-translation | Disable files translation | `false` | LT_DISABLE_FILES_TRANSLATION | | --disable-web-ui | Disable web ui | `false` | LT_DISABLE_WEB_UI | diff --git a/app/default_values.py b/app/default_values.py index 06605ce..88a32ef 100644 --- a/app/default_values.py +++ b/app/default_values.py @@ -131,6 +131,11 @@ _default_options_objects = [ 'default_value': None, 'value_type': 'str' }, + { + 'name': 'THREADS', + 'default_value': 4, + 'value_type': 'int' + }, { 'name': 'SUGGESTIONS', 'default_value': False, diff --git a/app/main.py b/app/main.py index 530d9f8..0df79fb 100644 --- a/app/main.py +++ b/app/main.py @@ -120,6 +120,13 @@ def get_args(): metavar="", help="Set available languages (ar,de,en,es,fr,ga,hi,it,ja,ko,pt,ru,zh)", ) + parser.add_argument( + "--threads", + default=DEFARGS['THREADS'], + type=int, + metavar="", + help="Set number of threads (%(default)s)", + ) parser.add_argument( "--suggestions", default=DEFARGS['SUGGESTIONS'], action="store_true", help="Allow user suggestions" ) @@ -154,6 +161,7 @@ def main(): host=args.host, port=args.port, url_scheme=url_scheme, + threads=args.threads )