Mercurial > code > home > repos > homeauto
changeset 670:f70514b127d2
service that calls for TTS audio then serves it to chromecasts and to playAudio services
Ignore-this: 4ede3d6eb6b35096f70fc35ffe5c7a07
author | drewp@bigasterisk.com |
---|---|
date | Sun, 22 Dec 2019 00:35:58 -0800 |
parents | b27a4652cd84 |
children | 74688c4763fe |
files | service/announce/Dockerfile service/announce/Dockerfile.speechServer service/announce/index.html service/announce/requirements.txt service/announce/serv.n3 service/announce/tasks.py |
diffstat | 6 files changed, 117 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/announce/Dockerfile Sun Dec 22 00:35:58 2019 -0800 @@ -0,0 +1,21 @@ +FROM bang6:5000/base_x86 + +WORKDIR /opt + +RUN apt-get update +RUN apt-get install -y openjdk-11-jre-headless unzip + +RUN wget https://github.com/marytts/marytts/releases/download/v5.2/marytts-5.2.zip && \ + unzip marytts-5.2.zip && \ + rm marytts-5.2.zip + +RUN wget -O ./cast https://github.com/barnybug/go-cast/releases/download/0.1.0/cast-linux-amd64 && chmod 755 ./cast + +COPY requirements.txt ./ +RUN pip3 install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple -r requirements.txt + +COPY *.py *.html ./ + +EXPOSE 9010 + +CMD [ "python3", "./announce.py" ]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/announce/Dockerfile.speechServer Sun Dec 22 00:35:58 2019 -0800 @@ -0,0 +1,22 @@ +FROM bang6:5000/base_x86 + +WORKDIR /opt + +RUN apt-get update +RUN apt-get install -y openjdk-11-jre-headless unzip + +RUN wget https://github.com/marytts/marytts/releases/download/v5.2/marytts-5.2.zip && \ + unzip marytts-5.2.zip && \ + rm marytts-5.2.zip + +#RUN apt-get install -y mbrola-us1 mbrola-us2 + +RUN cd /opt/marytts-5.2; \ + wget https://github.com/marytts/voice-dfki-poppy/releases/download/v5.2/voice-dfki-poppy-5.2.zip && unzip voice-dfki-poppy-5.2.zip; \ + wget https://github.com/marytts/voice-dfki-poppy-hsmm/releases/download/v5.2/voice-dfki-poppy-hsmm-5.2.zip && unzip voice-dfki-poppy-hsmm-5.2.zip; \ + wget https://github.com/marytts/voice-cmu-slt/releases/download/v5.2/voice-cmu-slt-5.2.zip && unzip voice-cmu-slt-5.2.zip; + + +EXPOSE 59125 + +CMD [ "/opt/marytts-5.2/bin/marytts-server" ]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/announce/index.html Sun Dec 22 00:35:58 2019 -0800 @@ -0,0 +1,22 @@ +<!doctype html> +<html> + <head> + <title></title> + <meta charset="utf-8" /> + </head> + <body> + <style> + input { width: 50em; } + </style> + <input type="text" id="msg"> + <button id="demo">speak</button> + <script> + document.querySelector('#msg').value = 'ding! <prosody rate="100%" pitch="+0%"> normal speech! </prosody>'; + document.querySelector('#demo').addEventListener('click', () => { + fetch('announcement?text=' + encodeURIComponent(document.querySelector('#msg').value), { + method: 'POST', + }); + }); + </script> + </body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/announce/requirements.txt Sun Dec 22 00:35:58 2019 -0800 @@ -0,0 +1,7 @@ +cyclone +mock==1.0.1 +Twisted +treq==18.6.0 +lru-dict==1.1.6 + +standardservice==0.6.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/announce/serv.n3 Sun Dec 22 00:35:58 2019 -0800 @@ -0,0 +1,30 @@ +@prefix : <http://bigasterisk.com/ns/serv#> . +@prefix auth: <http://bigasterisk.com/ns/serv/auth#> . +@prefix serv: <http://bigasterisk.com/services/> . + +serv:announce a :Service; + :path "/announce/"; + :openid auth:admin; + :serverHost "bang"; + :internalPort 9010; + :prodDockerFlags ( + "-p" "9010:9010" + "--net=host" + ); + :localDockerFlags ( + "--mount" "type=bind,source=/my/proj/homeauto/service/announce/announce.py,target=/opt/announce.py" + "--mount" "type=bind,source=/my/proj/homeauto/service/announce/index.html,target=/opt/index.html" + ); + :localRunCmdline ("python3" "announce.py" "-v"); + :dockerFile "Dockerfile" +. + + +serv:tts_server a :Service; + :openid auth:admin; + :serverHost "bang"; + :internalPort 59125; + :prodDockerFlags ("-p" "59125:59125"); + :dockerFile "Dockerfile.speechServer" +. +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/announce/tasks.py Sun Dec 22 00:35:58 2019 -0800 @@ -0,0 +1,15 @@ +from invoke import task, Collection + +import sys +sys.path.append('/my/proj/release') +from serv_tasks import serv_tasks + +ns = Collection() + +coll = Collection('announce') +ns.add_collection(coll) +serv_tasks(coll, 'serv.n3', 'announce') + +coll = Collection('tts') +ns.add_collection(coll) +serv_tasks(ns, 'serv.n3', 'tts_server')