feat: add optional Laya engine mode for grouping and language detection (#12)

Add a languageDetectionMode setting (algo | laya | laya+algo) exposed
in Settings with three engine choices. When Laya is enabled, a laya
service (Dockerfile.laya, optional compose profile, models stored
outside the repo under ./data/models/laya) can be started, with model
download and deletion from the UI via /laya routes to manage disk
space. Add a channelLanguageFusion service combining Laya results
with the existing algorithm, and wire detection mode through
grouping, channel list and player. Cover engine selection, fusion
and laya service behavior with tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-02 11:13:34 +02:00
parent 9e80655fd9
commit ce11ecc757
19 changed files with 780 additions and 13 deletions

23
Dockerfile.laya Normal file
View File

@ -0,0 +1,23 @@
FROM python:3.12-slim
ARG TORCH_VERSION=2.14.1
# Install the CPU wheel explicitly before Laya so pip does not select the much
# larger CUDA build. Model weights remain runtime-only in the mounted cache.
RUN python -m pip install --no-cache-dir \
"torch==${TORCH_VERSION}" \
--index-url https://download.pytorch.org/whl/cpu \
&& python -m pip install --no-cache-dir "laya[serve]>=0.3.22,<0.4" \
&& python -m pip check \
&& python -c "import torch; assert torch.version.cuda is None, torch.version.cuda"
ENV HF_HOME=/models \
LAYA_HOST=0.0.0.0 \
LAYA_PORT=8000 \
LAYA_PRELOAD=0 \
LAYA_DEVICE=cpu
VOLUME ["/models"]
EXPOSE 8000
CMD ["laya-serve"]