From a8c86efea9f9bbdd73d20e55abb8ec943988a955 Mon Sep 17 00:00:00 2001 From: Lee Azzarello Date: Fri, 5 Jan 2024 17:30:02 -0800 Subject: [PATCH] remove workflows, modify demo --- .github/workflows/pypi-release.yml | 94 ------------------------------ .github/workflows/style_check.yml | 46 --------------- fastapi-server/Dockerfile | 4 +- fastapi-server/demo.py | 4 +- fastapi-server/xtts-server.service | 11 ++++ 5 files changed, 15 insertions(+), 144 deletions(-) delete mode 100644 .github/workflows/pypi-release.yml delete mode 100644 .github/workflows/style_check.yml create mode 100644 fastapi-server/xtts-server.service diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml deleted file mode 100644 index 2bbcf3cd70..0000000000 --- a/.github/workflows/pypi-release.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Publish Python 🐍 distributions 📦 to PyPI -on: - release: - types: [published] -defaults: - run: - shell: - bash -jobs: - build-sdist: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: Verify tag matches version - run: | - set -ex - version=$(cat TTS/VERSION) - tag="${GITHUB_REF/refs\/tags\/}" - if [[ "v$version" != "$tag" ]]; then - exit 1 - fi - - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - run: | - python -m pip install -U pip setuptools wheel build - - run: | - python -m build - - run: | - pip install dist/*.tar.gz - - uses: actions/upload-artifact@v2 - with: - name: sdist - path: dist/*.tar.gz - build-wheels: - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11"] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install pip requirements - run: | - python -m pip install -U pip setuptools wheel build - python -m pip install -r requirements.txt - - name: Setup and install manylinux1_x86_64 wheel - run: | - python setup.py bdist_wheel --plat-name=manylinux1_x86_64 - python -m pip install dist/*-manylinux*.whl - - uses: actions/upload-artifact@v2 - with: - name: wheel-${{ matrix.python-version }} - path: dist/*-manylinux*.whl - publish-artifacts: - runs-on: ubuntu-20.04 - needs: [build-sdist, build-wheels] - steps: - - run: | - mkdir dist - - uses: actions/download-artifact@v2 - with: - name: "sdist" - path: "dist/" - - uses: actions/download-artifact@v2 - with: - name: "wheel-3.9" - path: "dist/" - - uses: actions/download-artifact@v2 - with: - name: "wheel-3.10" - path: "dist/" - - uses: actions/download-artifact@v2 - with: - name: "wheel-3.11" - path: "dist/" - - run: | - ls -lh dist/ - - name: Setup PyPI config - run: | - cat << EOF > ~/.pypirc - [pypi] - username=__token__ - password=${{ secrets.PYPI_TOKEN }} - EOF - - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - run: | - python -m pip install twine - - run: | - twine upload --repository pypi dist/* diff --git a/.github/workflows/style_check.yml b/.github/workflows/style_check.yml deleted file mode 100644 index b7c6393baa..0000000000 --- a/.github/workflows/style_check.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: style-check - -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] -jobs: - check_skip: - runs-on: ubuntu-latest - if: "! contains(github.event.head_commit.message, '[ci skip]')" - steps: - - run: echo "${{ github.event.head_commit.message }}" - - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [3.9] - experimental: [false] - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - architecture: x64 - cache: 'pip' - cache-dependency-path: 'requirements*' - - name: check OS - run: cat /etc/os-release - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y git make gcc - make system-deps - - name: Install/upgrade Python setup deps - run: python3 -m pip install --upgrade pip setuptools wheel - - name: Install TTS - run: | - python3 -m pip install .[all] - python3 setup.py egg_info - - name: Style check - run: make style diff --git a/fastapi-server/Dockerfile b/fastapi-server/Dockerfile index 0ff6a13f03..7546e4514e 100644 --- a/fastapi-server/Dockerfile +++ b/fastapi-server/Dockerfile @@ -1,9 +1,9 @@ FROM python:3.10 -RUN mkdir /code +RUN mkdir -p /code/test WORKDIR /code COPY demo.py test/default_speaker.json /code/ -RUN mkdir /code/test/ COPY test/ /code/test/ +RUN apt-get -y update && apt-get -y install ffmpeg RUN pip install gradio requests CMD ["python", "demo.py"] diff --git a/fastapi-server/demo.py b/fastapi-server/demo.py index bf5cb64d98..2e7c5197a5 100644 --- a/fastapi-server/demo.py +++ b/fastapi-server/demo.py @@ -6,7 +6,7 @@ import os -SERVER_URL = 'https://bazsyqz5jc4up9-8888.proxy.runpod.net:443' +SERVER_URL = os.environ.get("TTS_API_ENDPOINT", 'http://localhost:8888') OUTPUT = "./demo_outputs" cloned_speakers = {} @@ -40,7 +40,7 @@ def clone_speaker(upload_file, clone_speaker_name, cloned_speaker_names): json.dump(embeddings, fp) cloned_speakers[clone_speaker_name] = embeddings cloned_speaker_names.append(clone_speaker_name) - return upload_file, clone_speaker_name, cloned_speaker_names, gr.Dropdown.update(choices=cloned_speaker_names) + return upload_file, clone_speaker_name, cloned_speaker_names, gr.Dropdown(choices=cloned_speaker_names) def tts(text, speaker_type, speaker_name_studio, speaker_name_custom, lang): embeddings = STUDIO_SPEAKERS[speaker_name_studio] if speaker_type == 'Studio' else cloned_speakers[speaker_name_custom] diff --git a/fastapi-server/xtts-server.service b/fastapi-server/xtts-server.service new file mode 100644 index 0000000000..6de243acbb --- /dev/null +++ b/fastapi-server/xtts-server.service @@ -0,0 +1,11 @@ +[Unit] +Description=A xTTS speech synthesis server + +[Service] +User=ubuntu +WorkingDirectory=/home/ubuntu/xtts-streaming-server/server +ExecStart=/home/ubuntu/TTS/.venv/bin/python /home/ubuntu/TTS/.venv/bin/uvicorn main:app --host 0.0.0.0 --port 8888 +Restart=always + +[Install] +WantedBy=multi-user.target