-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Oct 22, 2024
1 parent
432cca7
commit 4d89d89
Showing
7 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dirs |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ARG BUILD_FROM | ||
FROM ${BUILD_FROM} | ||
|
||
# Set shell | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
# Install wyoming-vosk | ||
WORKDIR /usr/src | ||
ARG WYOMING_VOSK_VERSION | ||
ENV PIP_BREAK_SYSTEM_PACKAGES=1 | ||
|
||
RUN \ | ||
apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
netcat-traditional \ | ||
python3 \ | ||
python3-pip \ | ||
libatomic1 \ | ||
&& pip3 install --no-cache-dir -U \ | ||
setuptools \ | ||
wheel \ | ||
&& pip3 install --no-cache-dir \ | ||
--extra-index-url https://www.piwheels.org/simple \ | ||
-f . \ | ||
"wyoming-vosk[limited] @ https://github.com/rhasspy/wyoming-vosk/archive/refs/tags/v${WYOMING_VOSK_VERSION}.tar.gz" \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR / | ||
COPY start.sh /start.sh | ||
ENTRYPOINT ["bash", "start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BUILD_FROM=ghcr.io/home-assistant/amd64-base-debian:bookworm | ||
WYOMING_VOSK_VERSION=1.5.0 | ||
docker build --build-arg BUILD_FROM=${BUILD_FROM} \ | ||
--build-arg WYOMING_VOSK_VERSION=${WYOMING_VOSK_VERSION} \ | ||
-t wyoming-vosk-standalone:${WYOMING_VOSK_VERSION} \ | ||
-f Dockerfile . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: "2" | ||
services: | ||
vosk: | ||
image: wyoming-vosk-standalone:1.5.0 | ||
environment: | ||
- CORRECT_SENTENCES=0.0 | ||
- PRELOAD_LANGUAGE=en | ||
- DEBUG_LOGGING=TRUE | ||
- LIMIT_SENTENCES=TRUE | ||
- ALLOW_UNKNOWN=False | ||
volumes: | ||
- ./dirs/data:/data | ||
- ./dirs/sentences:/share/vosk/sentences | ||
ports: | ||
- 10300:10300 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
flags=() | ||
|
||
CORRECT_SENTENCES="${CORRECT_SENTENCES:-0.0}" | ||
PRELOAD_LANGUAGE="${PRELOAD_LANGUAGE:-en}" | ||
|
||
if [ "${DEBUG_LOGGING}" == "TRUE" ]; then | ||
flags+=('--debug') | ||
fi | ||
|
||
if [ "${LIMIT_SENTENCES}" == "TRUE" ]; then | ||
flags+=('--limit-sentences') | ||
fi | ||
|
||
if [ "${ALLOW_UNKNOWN}" == "TRUE" ]; then | ||
flags+=('--allow-unknown') | ||
fi | ||
|
||
echo CORRECT_SENTENCES = ${CORRECT_SENTENCES} | ||
echo PRELOAD_LANGUAGE = ${PRELOAD_LANGUAGE} | ||
echo DEBUG_LOGGING = ${DEBUG_LOGGING} | ||
echo LIMIT_SENTENCES = ${LIMIT_SENTENCES} | ||
echo ALLOW_UNKNOWN = ${ALLOW_UNKNOWN} | ||
|
||
if [ -d '/share/vosk/models' ]; then | ||
# Each directory is a language name with a model inside | ||
while read -r lang_dir; do | ||
# Override the model for this language | ||
lang="$(basename "${lang_dir}")" | ||
flags+=('--model-for-language' "${lang}" "$(realpath "${lang_dir}")") | ||
done < <(find '/share/vosk/models' -mindepth 1 -maxdepth 1 -type d) | ||
fi | ||
|
||
echo flags = ${flags[@]} | ||
python3 -m wyoming_vosk \ | ||
--uri 'tcp://0.0.0.0:10300' \ | ||
--data-dir /data \ | ||
--download-dir /data \ | ||
--data-dir /share/vosk/models \ | ||
--sentences-dir /share/vosk/sentences \ | ||
--correct-sentences $CORRECT_SENTENCES \ | ||
--language $PRELOAD_LANGUAGE \ | ||
--preload-language $PRELOAD_LANGUAGE ${flags[@]} |