mirror of
https://github.com/YunoHost-Apps/libretranslate_ynh.git
synced 2024-09-03 19:36:00 +02:00
Add a setting for installing additional languages and comments with warnings.
This commit is contained in:
parent
6719574ed4
commit
dc05a95e32
2 changed files with 21 additions and 6 deletions
|
@ -34,6 +34,13 @@ ram.runtime = "50M"
|
|||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.additional_languages]
|
||||
ask.en = "Do install additional language models? WARNING: It will take ~6 GB of your free space."
|
||||
help.en = "By default, installed models are English->French and French->English."
|
||||
yes = "true"
|
||||
no = "false"
|
||||
type = "boolean"
|
||||
|
||||
[resources]
|
||||
[resources.sources]
|
||||
|
||||
|
|
|
@ -28,11 +28,19 @@ pushd $install_dir
|
|||
source $install_dir/venv/bin/activate
|
||||
ynh_exec_warn_less pip install libretranslate=="$(ynh_app_upstream_version)" toml
|
||||
|
||||
# Install additional languages (FIXME!!!)
|
||||
# WARNING!!! CODE BELOW WASN'T TESTED!!! RUN IN DEBUG MODE FROM SHELL!!!
|
||||
# Checking if additional_languages was enabled...
|
||||
if [ "$additional_languages" = true ] ; then
|
||||
|
||||
# ...if yes, download models...
|
||||
venv/bin/libretranslate --update-models &
|
||||
|
||||
# ...and then kill the libretranslate process
|
||||
# because it was started after downloading models!
|
||||
export LT-PID="$!"
|
||||
if [ ss -tulpen | grep '127.0.0.1:5000' ] ; then
|
||||
kill -INT "$!"
|
||||
if ss -tulpen | grep '127.0.0.1:5000' ; then
|
||||
kill -INT "$LT_PID"
|
||||
fi
|
||||
fi
|
||||
popd
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue