1
0
Fork 0
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:
lotigara 2024-07-19 23:26:56 +03:00
parent 6719574ed4
commit dc05a95e32
2 changed files with 21 additions and 6 deletions

View file

@ -34,6 +34,13 @@ ram.runtime = "50M"
type = "group" type = "group"
default = "visitors" 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]
[resources.sources] [resources.sources]

View file

@ -28,11 +28,19 @@ pushd $install_dir
source $install_dir/venv/bin/activate source $install_dir/venv/bin/activate
ynh_exec_warn_less pip install libretranslate=="$(ynh_app_upstream_version)" toml 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 & venv/bin/libretranslate --update-models &
# ...and then kill the libretranslate process
# because it was started after downloading models!
export LT-PID="$!" export LT-PID="$!"
if [ ss -tulpen | grep '127.0.0.1:5000' ] ; then if ss -tulpen | grep '127.0.0.1:5000' ; then
kill -INT "$!" kill -INT "$LT_PID"
fi
fi fi
popd popd