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"
|
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]
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,20 @@ 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!!!
|
||||||
venv/bin/libretranslate --update-models &
|
# Checking if additional_languages was enabled...
|
||||||
export LT-PID="$!"
|
if [ "$additional_languages" = true ] ; then
|
||||||
if [ ss -tulpen | grep '127.0.0.1:5000' ] ; then
|
|
||||||
kill -INT "$!"
|
# ...if yes, download models...
|
||||||
fi
|
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 "$LT_PID"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue