Add --threads

This commit is contained in:
Piero Toffanin 2022-07-15 12:12:20 -04:00
parent e4fe0e8919
commit 1dddcea794
3 changed files with 14 additions and 0 deletions

View file

@ -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 | | --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 | | --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 | | --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 | | --suggestions | Allow user suggestions | `false` | LT_SUGGESTIONS |
| --disable-files-translation | Disable files translation | `false` | LT_DISABLE_FILES_TRANSLATION | | --disable-files-translation | Disable files translation | `false` | LT_DISABLE_FILES_TRANSLATION |
| --disable-web-ui | Disable web ui | `false` | LT_DISABLE_WEB_UI | | --disable-web-ui | Disable web ui | `false` | LT_DISABLE_WEB_UI |

View file

@ -131,6 +131,11 @@ _default_options_objects = [
'default_value': None, 'default_value': None,
'value_type': 'str' 'value_type': 'str'
}, },
{
'name': 'THREADS',
'default_value': 4,
'value_type': 'int'
},
{ {
'name': 'SUGGESTIONS', 'name': 'SUGGESTIONS',
'default_value': False, 'default_value': False,

View file

@ -120,6 +120,13 @@ def get_args():
metavar="<comma-separated language codes>", metavar="<comma-separated language codes>",
help="Set available languages (ar,de,en,es,fr,ga,hi,it,ja,ko,pt,ru,zh)", 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="<number of threads>",
help="Set number of threads (%(default)s)",
)
parser.add_argument( parser.add_argument(
"--suggestions", default=DEFARGS['SUGGESTIONS'], action="store_true", help="Allow user suggestions" "--suggestions", default=DEFARGS['SUGGESTIONS'], action="store_true", help="Allow user suggestions"
) )
@ -154,6 +161,7 @@ def main():
host=args.host, host=args.host,
port=args.port, port=args.port,
url_scheme=url_scheme, url_scheme=url_scheme,
threads=args.threads
) )