-
Notifications
You must be signed in to change notification settings - Fork 93
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
matatonic
committed
Apr 27, 2024
1 parent
a2a3d2b
commit 6864cf0
Showing
16 changed files
with
260 additions
and
70 deletions.
There are no files selected for viewing
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,127 @@ | ||
name: Build and Publish Docker Image | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
env: | ||
# Set up environment variables for the job | ||
DOCKER_REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
TAG: ${{ github.sha }} | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
install: true | ||
|
||
# Log in to the GitHub Container Registry only when not running on a pull request event | ||
- name: Login to Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push the Docker image to GHCR for the main branch or specific tags | ||
- name: Build and Push Docker Image | ||
if: github.ref == 'refs/heads/main' | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: version=${{ github.run_id }} | ||
|
||
# For tagged releases, build and push the Docker image with the corresponding tag | ||
- name: Build and Push Docker Image (Tagged) | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} | ||
labels: version=${{ github.run_id }} | ||
|
||
build-and-push-alt-image: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
env: | ||
# Set up environment variables for the job | ||
DOCKER_REGISTRY: ghcr.io | ||
IMAGE_NAME: matatonic/openedai-speech-min | ||
TAG: ${{ github.sha }} | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
install: true | ||
|
||
# Log in to the GitHub Container Registry only when not running on a pull request event | ||
- name: Login to Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push the Docker image to GHCR for the main branch or specific tags | ||
- name: Build and Push Docker Image | ||
if: github.ref == 'refs/heads/main' | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile.min | ||
push: true | ||
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: version=${{ github.run_id }} | ||
|
||
# For tagged releases, build and push the Docker image with the corresponding tag | ||
- name: Build and Push Docker Image (Tagged) | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile.min | ||
push: true | ||
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} | ||
labels: version=${{ github.run_id }} | ||
|
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
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 |
---|---|---|
@@ -1,24 +1,17 @@ | ||
FROM python:3.11-slim | ||
|
||
ENV COQUI_TOS_AGREED=1 | ||
ENV PRELOAD_MODEL=xtts | ||
# or PRELOAD_MODEL=parler-tts/parler_tts_mini_v0.1 | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y curl git ffmpeg | ||
|
||
#RUN git clone https://github.com/matatonic/openedai-speech /app | ||
RUN mkdir -p /app/voices | ||
# default clone of the default voice is really bad, use a better default | ||
COPY voices/alloy-alt.wav /app/voices/ | ||
WORKDIR /app | ||
COPY *.txt /app/ | ||
RUN pip install --no-cache -r requirements.txt | ||
COPY *.sh /app/ | ||
RUN ./download_voices_tts-1.sh | ||
RUN ./download_voices_tts-1-hd.sh | ||
COPY *.py *.yaml *.md LICENSE /app/ | ||
COPY *.sh *.py *.yaml *.md LICENSE config /app/ | ||
|
||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
CMD python speech.py --host 0.0.0.0 --port 8000 --preload $PRELOAD_MODEL | ||
ENV CLI_COMMAND="python speech.py" | ||
CMD $CLI_COMMAND |
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
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
File renamed without changes.
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
for i in alloy echo fable onyx nova shimmer; do | ||
curl -s https://cdn.openai.com/API/docs/audio/$i.wav | ffmpeg -loglevel error -i - -ar 22050 -ac 1 voices/$i.wav | ||
[ ! -e "voices/$i.wav" ] && curl -s https://cdn.openai.com/API/docs/audio/$i.wav | ffmpeg -loglevel error -i - -ar 22050 -ac 1 voices/$i.wav | ||
done |
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 |
---|---|---|
@@ -1,4 +1,9 @@ | ||
#!/bin/sh | ||
export COQUI_TOS_AGREED=1 | ||
python -c "from TTS.utils.manage import ModelManager; ModelManager().download_model('$PRELOAD_MODEL')" | ||
export TTS_HOME=voices | ||
|
||
MODELS=${*:-xtts} | ||
for model in $MODELS; do | ||
python -c "from TTS.utils.manage import ModelManager; ModelManager().download_model('$model')" | ||
done | ||
./download_samples.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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
fastapi | ||
uvicorn | ||
# piper-tts | ||
piper-tts | ||
piper-tts==1.2.0 | ||
onnxruntime-gpu | ||
# xtts | ||
TTS | ||
|
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 @@ | ||
TTS_HOME=voices | ||
HF_HOME=voices | ||
#PRELOAD_MODEL=xtts | ||
#PRELOAD_MODEL=xtts_v2.0.2 | ||
#CLI_COMMAND="python speech.py --preload $PRELOAD_MODEL" | ||
#CLI_COMMAND="python speech.py --xtts_device none" # for piper only |
Oops, something went wrong.