diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml deleted file mode 100644 index d4a5d88..0000000 --- a/.github/workflows/publish_docker.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Publish Docker Container -on: - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: NeonGeckoCom/coqui-tts - -jobs: - build_and_publish_docker: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v2 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=raw,value=latest - type=semver,pattern={{version}} - - - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 9e06d3b..41f0e79 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -6,6 +6,10 @@ on: branches: - master +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: tag_release: runs-on: ubuntu-latest @@ -19,7 +23,7 @@ jobs: with: token: ${{secrets.GITHUB_TOKEN}} tag: ${{env.VERSION}} - build_and_publish: + build_and_publish_pypi: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -35,6 +39,50 @@ jobs: run: | python setup.py sdist bdist_wheel - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{secrets.PYPI_TOKEN}} + build_and_publish_docker: + runs-on: ubuntu-latest + needs: build_and_publish_pypi + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Get Version + id: version + run: | + VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version)) + echo ::set-output name=version::${VERSION} + env: + image_name: ${{ env.IMAGE_NAME }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v2 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=raw,value=latest + type=semver,pattern={{version}},value=${{ steps.version.outputs.version }} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml index 879f52b..ff7dc73 100644 --- a/.github/workflows/publish_test_build.yml +++ b/.github/workflows/publish_test_build.yml @@ -8,8 +8,12 @@ on: paths-ignore: - 'version.py' +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: - build_and_publish: + build_and_publish_pypi: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -34,6 +38,49 @@ jobs: run: | python setup.py sdist bdist_wheel - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{secrets.PYPI_TOKEN}} + build_and_publish_docker: + runs-on: ubuntu-latest + needs: build_and_publish_pypi + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Get Version + id: version + run: | + VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version)) + echo ::set-output name=version::${VERSION} + env: + image_name: ${{ env.IMAGE_NAME }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v2 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}},value=${{ steps.version.outputs.version }} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7b72422..0340136 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ FROM python:3.9-slim-bullseye AS compile-image -RUN apt-get update -y && apt-get install -y python3-pip +RUN apt-get update -y && apt-get install -y python3-pip git RUN pip3 install --user torch --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -RUN pip3 install --user neon-tts-plugin-coqui --no-cache-dir -RUN pip3 install --user ovos-tts-server==0.0.2 --no-cache-dir +COPY . /tmp/neon-tts-plugin-coqui +RUN pip3 install --user /tmp/neon-tts-plugin-coqui --no-cache-dir + +RUN pip3 install --user git+https://github.com/OpenVoiceOS/ovos-tts-server@b9ee84c48ab6ab5655fffa032359752ab10d2c9d FROM python:3.9-slim-bullseye AS build-image @@ -13,4 +15,4 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends espeak-ng COPY --from=compile-image /root/.local /root/.local ENV PATH=/root/.local/bin:$PATH -ENTRYPOINT ovos-tts-server --engine neon-tts-plugin-coqui \ No newline at end of file +ENTRYPOINT ovos-tts-server --engine coqui \ No newline at end of file diff --git a/neon_tts_plugin_coqui/__init__.py b/neon_tts_plugin_coqui/__init__.py index 8a47158..898bdc8 100644 --- a/neon_tts_plugin_coqui/__init__.py +++ b/neon_tts_plugin_coqui/__init__.py @@ -69,17 +69,20 @@ def __init__(self, lang="en", config=None, *args, **kwargs): self._init_model({"lang": lang}) def get_tts(self, sentence: str, output_file: str, - speaker: Optional[dict] = None) -> (str, Optional[str]): + speaker: Optional[dict] = None, lang: Optional[str] = None) -> (str, Optional[str]): """ Get Synthesized audio Args: sentence: string to synthesize output_file: path to output audio file speaker: optional dict speaker data - + lang: optional lang override Returns: tuple wav_file, optional phonemes """ + if lang: + speaker = speaker or dict() + speaker['language'] = lang wav_data, synthesizer = self.get_audio(sentence, speaker, audio_format="internal") self._audio_to_file(wav_data, synthesizer, output_file) diff --git a/version.py b/version.py index 7680be6..27362a0 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "0.7.1" +__version__ = "0.7.2"