Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .github/actions/uv/action.yml +16 -0
- .github/dependabot.yml +19 -0
- .github/hadolint.yml +6 -0
- .github/mergify.yml +34 -0
- .github/workflows/code_analysis.yml +51 -0
- .github/workflows/docker.yml +72 -0
- .github/workflows/github.yaml +76 -0
- .github/workflows/huggingface.yml +30 -0
- Dockerfile +1 -1
- src/vocalizr/__init__.py +1 -1
.github/actions/uv/action.yml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: 'Setup UV'
|
2 |
+
description: 'Reusable set of steps to Setup UV'
|
3 |
+
runs:
|
4 |
+
using: "composite"
|
5 |
+
steps:
|
6 |
+
- name: Install uv
|
7 |
+
uses: astral-sh/setup-uv@v6
|
8 |
+
id: uv
|
9 |
+
with:
|
10 |
+
enable-cache: true
|
11 |
+
cache-dependency-glob: "uv.lock"
|
12 |
+
activate-environment: true
|
13 |
+
- name: Install the project
|
14 |
+
shell: bash
|
15 |
+
if: steps.uv.outputs.cache-hit != 'true'
|
16 |
+
run: uv sync --frozen
|
.github/dependabot.yml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# To get started with Dependabot version updates, you'll need to specify which
|
2 |
+
# package ecosystems to update and where the package manifests are located.
|
3 |
+
# Please see the documentation for all configuration options:
|
4 |
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
5 |
+
|
6 |
+
# version: 2
|
7 |
+
# updates:
|
8 |
+
# - package-ecosystem: "docker"
|
9 |
+
# directory: "/"
|
10 |
+
# schedule:
|
11 |
+
# interval: "weekly"
|
12 |
+
# - package-ecosystem: "github-actions"
|
13 |
+
# directory: "/"
|
14 |
+
# schedule:
|
15 |
+
# interval: "weekly"
|
16 |
+
# - package-ecosystem: "uv"
|
17 |
+
# directory: "/"
|
18 |
+
# schedule:
|
19 |
+
# interval: "weekly"
|
.github/hadolint.yml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ignored:
|
2 |
+
- DL3008
|
3 |
+
|
4 |
+
trustedRegistries:
|
5 |
+
- docker.io
|
6 |
+
- ghcr.io
|
.github/mergify.yml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pull_request_rules:
|
2 |
+
- name: Automatically merge Renovate PRs
|
3 |
+
conditions:
|
4 |
+
- author = renovate[bot]
|
5 |
+
- check-success = spelling
|
6 |
+
- check-success = ruff
|
7 |
+
- check-success = pyright
|
8 |
+
- check-success = pylint
|
9 |
+
- check-success = dockerfile
|
10 |
+
- check-success = check_image
|
11 |
+
actions:
|
12 |
+
queue:
|
13 |
+
label:
|
14 |
+
add:
|
15 |
+
- dependencies
|
16 |
+
- name: Automatically merge DeepSource Autofix PRs
|
17 |
+
conditions:
|
18 |
+
- author = deepsource-autofix[bot]
|
19 |
+
- check-success = spelling
|
20 |
+
- check-success = ruff
|
21 |
+
- check-success = pyright
|
22 |
+
- check-success = pylint
|
23 |
+
- check-success = dockerfile
|
24 |
+
- check-success = check_image
|
25 |
+
actions:
|
26 |
+
queue:
|
27 |
+
label:
|
28 |
+
add:
|
29 |
+
- enhancement
|
30 |
+
queue_rules:
|
31 |
+
- queue_branch_merge_method: fast-forward
|
32 |
+
allow_queue_branch_edit: true
|
33 |
+
update_method: merge
|
34 |
+
name: default
|
.github/workflows/code_analysis.yml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Code Analysis
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
workflow_dispatch:
|
5 |
+
permissions:
|
6 |
+
contents: read
|
7 |
+
jobs:
|
8 |
+
spelling:
|
9 |
+
runs-on: ubuntu-latest
|
10 |
+
steps:
|
11 |
+
- name: Checkout Actions Repository
|
12 |
+
uses: actions/checkout@v4
|
13 |
+
- name: Setup UV
|
14 |
+
uses: ./.github/actions/uv
|
15 |
+
- name: Run typos
|
16 |
+
run: uv run typos . --config ./pyproject.toml
|
17 |
+
ruff:
|
18 |
+
runs-on: ubuntu-latest
|
19 |
+
steps:
|
20 |
+
- name: Checkout Actions Repository
|
21 |
+
uses: actions/checkout@v4
|
22 |
+
- name: Setup UV
|
23 |
+
uses: ./.github/actions/uv
|
24 |
+
- name: Run Ruff
|
25 |
+
run: uv run ruff check .
|
26 |
+
pyright:
|
27 |
+
runs-on: ubuntu-latest
|
28 |
+
steps:
|
29 |
+
- name: Checkout Actions Repository
|
30 |
+
uses: actions/checkout@v4
|
31 |
+
- name: Setup UV
|
32 |
+
uses: ./.github/actions/uv
|
33 |
+
- name: Run Pyright
|
34 |
+
run: uv run pyright
|
35 |
+
pylint:
|
36 |
+
runs-on: ubuntu-latest
|
37 |
+
steps:
|
38 |
+
- name: Checkout Actions Repository
|
39 |
+
uses: actions/checkout@v4
|
40 |
+
- name: Setup UV
|
41 |
+
uses: ./.github/actions/uv
|
42 |
+
- name: Analysing the code with Pylint
|
43 |
+
run: uv run pylint $(git ls-files '*.py') --output-format=github --rcfile pyproject.toml
|
44 |
+
dockerfile:
|
45 |
+
runs-on: ubuntu-latest
|
46 |
+
steps:
|
47 |
+
- name: Checkout Actions Repository
|
48 |
+
uses: actions/checkout@v4
|
49 |
+
- uses: hadolint/[email protected]
|
50 |
+
with:
|
51 |
+
config: ./.github/hadolint.yml
|
.github/workflows/docker.yml
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Docker Images
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
workflow_dispatch:
|
5 |
+
permissions:
|
6 |
+
contents: read
|
7 |
+
packages: write
|
8 |
+
attestations: write
|
9 |
+
id-token: write
|
10 |
+
jobs:
|
11 |
+
check_image:
|
12 |
+
runs-on: ubuntu-latest
|
13 |
+
steps:
|
14 |
+
- name: Checkout repository
|
15 |
+
uses: actions/checkout@v4
|
16 |
+
- name: Log in to the Container registry
|
17 |
+
uses: docker/login-action@v3
|
18 |
+
with:
|
19 |
+
registry: ghcr.io
|
20 |
+
username: ${{ github.actor }}
|
21 |
+
password: ${{ secrets.TOKEN_KEY_GITHUB }}
|
22 |
+
- name: Validate build configuration
|
23 |
+
uses: docker/build-push-action@v6
|
24 |
+
with:
|
25 |
+
call: check
|
26 |
+
build_image:
|
27 |
+
needs: check_image
|
28 |
+
runs-on: ubuntu-latest
|
29 |
+
steps:
|
30 |
+
- name: Checkout repository
|
31 |
+
uses: actions/checkout@v4
|
32 |
+
- name: Log in to the Container registry
|
33 |
+
uses: docker/login-action@v3
|
34 |
+
with:
|
35 |
+
registry: ghcr.io
|
36 |
+
username: ${{ github.actor }}
|
37 |
+
password: ${{ secrets.TOKEN_KEY_GITHUB }}
|
38 |
+
- name: Set up QEMU
|
39 |
+
uses: docker/setup-qemu-action@v3
|
40 |
+
- name: Set up Docker Buildx
|
41 |
+
uses: docker/setup-buildx-action@v3
|
42 |
+
- name: Docker meta
|
43 |
+
id: meta
|
44 |
+
uses: docker/metadata-action@v5
|
45 |
+
with:
|
46 |
+
images: ghcr.io/${{ github.repository }}
|
47 |
+
tags: |
|
48 |
+
type=raw,value=latest,enable={{is_default_branch}}
|
49 |
+
type=raw,value=${{ github.ref_name }},enable=${{ github.ref != 'refs/heads/main' }}
|
50 |
+
- name: Build
|
51 |
+
uses: docker/build-push-action@v6
|
52 |
+
with:
|
53 |
+
cache-from: type=gha
|
54 |
+
cache-to: type=gha,mode=max
|
55 |
+
push: true
|
56 |
+
tags: ${{ steps.meta.outputs.tags }}
|
57 |
+
labels: ${{ steps.meta.outputs.labels }}
|
58 |
+
annotations: ${{ steps.meta.outputs.annotations }}
|
59 |
+
docker_scout:
|
60 |
+
needs:
|
61 |
+
- build_image
|
62 |
+
- check_image
|
63 |
+
runs-on: ubuntu-latest
|
64 |
+
steps:
|
65 |
+
- name: Docker Scout
|
66 |
+
continue-on-error: true
|
67 |
+
uses: docker/scout-action@v1
|
68 |
+
with:
|
69 |
+
command: quickview,cves,recommendations
|
70 |
+
dockerhub-user: mh0386
|
71 |
+
dockerhub-password: ${{ secrets.TOKEN_KEY_DOCKER }}
|
72 |
+
image: ghcr.io/${{ github.repository }}:latest
|
.github/workflows/github.yaml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: GitHub Release
|
2 |
+
on:
|
3 |
+
workflow_dispatch:
|
4 |
+
push:
|
5 |
+
tags:
|
6 |
+
- "[0-9]+.[0-9]+.[0-9]+"
|
7 |
+
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
|
8 |
+
- "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
|
9 |
+
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
|
10 |
+
env:
|
11 |
+
PACKAGE_NAME: vocalizr
|
12 |
+
OWNER: AlphaSphereDotAI
|
13 |
+
permissions:
|
14 |
+
contents: write
|
15 |
+
jobs:
|
16 |
+
details:
|
17 |
+
runs-on: ubuntu-latest
|
18 |
+
outputs:
|
19 |
+
new_version: ${{ steps.release.outputs.new_version }}
|
20 |
+
tag_name: ${{ steps.release.outputs.tag_name }}
|
21 |
+
steps:
|
22 |
+
- name: Checkout Code
|
23 |
+
uses: actions/[email protected]
|
24 |
+
- name: Extract tag and Details
|
25 |
+
id: release
|
26 |
+
run: |
|
27 |
+
if [ "${{ github.ref_type }}" = "tag" ]; then
|
28 |
+
TAG_NAME=${GITHUB_REF#refs/tags/}
|
29 |
+
NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}')
|
30 |
+
SUFFIX=$(echo $TAG_NAME | grep -oP '[a-z]+[0-9]+' || echo "")
|
31 |
+
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
|
32 |
+
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
|
33 |
+
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
34 |
+
echo "Version is $NEW_VERSION"
|
35 |
+
echo "Suffix is $SUFFIX"
|
36 |
+
echo "Tag name is $TAG_NAME"
|
37 |
+
else
|
38 |
+
echo "No tag found"
|
39 |
+
exit 1
|
40 |
+
fi
|
41 |
+
setup_and_build:
|
42 |
+
needs: [ details ]
|
43 |
+
runs-on: ubuntu-latest
|
44 |
+
steps:
|
45 |
+
- name: Checkout Code
|
46 |
+
uses: actions/[email protected]
|
47 |
+
- name: Setup UV
|
48 |
+
uses: ./.github/actions/uv
|
49 |
+
- name: Update Project Version
|
50 |
+
run: uv version ${{ needs.details.outputs.new_version }}
|
51 |
+
- name: Build source and wheel distribution
|
52 |
+
run: uv build --all-packages
|
53 |
+
- name: Upload artifacts
|
54 |
+
uses: actions/upload-artifact@v4
|
55 |
+
with:
|
56 |
+
name: dist
|
57 |
+
path: dist/
|
58 |
+
github_release:
|
59 |
+
name: Create GitHub Release
|
60 |
+
needs: [ setup_and_build, details ]
|
61 |
+
runs-on: ubuntu-latest
|
62 |
+
steps:
|
63 |
+
- name: Checkout Code
|
64 |
+
uses: actions/[email protected]
|
65 |
+
with:
|
66 |
+
fetch-depth: 0
|
67 |
+
- name: Download artifacts
|
68 |
+
uses: actions/download-artifact@v4
|
69 |
+
with:
|
70 |
+
name: dist
|
71 |
+
path: dist/
|
72 |
+
- name: Create GitHub Release
|
73 |
+
id: create_release
|
74 |
+
env:
|
75 |
+
GH_TOKEN: ${{ github.token }}
|
76 |
+
run: gh release create ${{ needs.details.outputs.tag_name }} dist/* --title ${{ needs.details.outputs.tag_name }} --generate-notes
|
.github/workflows/huggingface.yml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Push to HuggingFace
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
branches:
|
5 |
+
- main
|
6 |
+
env:
|
7 |
+
HF_HUB_ENABLE_HF_TRANSFER: 1
|
8 |
+
jobs:
|
9 |
+
huggingface:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
steps:
|
12 |
+
- name: Checkout
|
13 |
+
uses: actions/checkout@v4
|
14 |
+
- name: Setup UV
|
15 |
+
uses: ./.github/actions/uv
|
16 |
+
- name: Remove Unnecessary Files
|
17 |
+
run: |
|
18 |
+
echo ".github" >> .gitignore
|
19 |
+
echo ".idea" >> .gitignore
|
20 |
+
echo "docker-bake.hcl" >> .gitignore
|
21 |
+
echo "renovate.json" >> .gitignore
|
22 |
+
echo ".deepsource.toml" >> .gitignore
|
23 |
+
- name: Add to git credentials
|
24 |
+
run: git config --global credential.helper store
|
25 |
+
- name: Login to HuggingFace Hub
|
26 |
+
run: uv run huggingface-cli login --add-to-git-credential --token ${{ secrets.HF_TOKEN }}
|
27 |
+
- name: Check if logged in
|
28 |
+
run: uv run huggingface-cli whoami
|
29 |
+
- name: Upload
|
30 |
+
run: uv run huggingface-cli upload AlphaSphereDotAI/Vocalizr . . --repo-type space
|
Dockerfile
CHANGED
@@ -41,4 +41,4 @@ USER vocalizr
|
|
41 |
|
42 |
EXPOSE ${GRADIO_SERVER_PORT}
|
43 |
|
44 |
-
CMD ["python", "src/vocalizr"]
|
|
|
41 |
|
42 |
EXPOSE ${GRADIO_SERVER_PORT}
|
43 |
|
44 |
+
CMD ["python", "src/vocalizr"]
|
src/vocalizr/__init__.py
CHANGED
@@ -16,7 +16,7 @@ SERVER_PORT: int = int(getenv(key="GRADIO_SERVER_PORT", default="8080"))
|
|
16 |
PIPELINE: KPipeline = KPipeline(lang_code="a", repo_id="hexgrad/Kokoro-82M")
|
17 |
CURRENT_DATE: str = datetime.now().strftime(format="%Y-%m-%d_%H-%M-%S")
|
18 |
|
19 |
-
BASE_DIR: Path = Path
|
20 |
RESULTS_DIR: Path = BASE_DIR / "results"
|
21 |
LOG_DIR: Path = BASE_DIR / "logs"
|
22 |
AUDIO_FILE_PATH: Path = RESULTS_DIR / f"{CURRENT_DATE}.wav"
|
|
|
16 |
PIPELINE: KPipeline = KPipeline(lang_code="a", repo_id="hexgrad/Kokoro-82M")
|
17 |
CURRENT_DATE: str = datetime.now().strftime(format="%Y-%m-%d_%H-%M-%S")
|
18 |
|
19 |
+
BASE_DIR: Path = Path(__file__).parent.parent.parent
|
20 |
RESULTS_DIR: Path = BASE_DIR / "results"
|
21 |
LOG_DIR: Path = BASE_DIR / "logs"
|
22 |
AUDIO_FILE_PATH: Path = RESULTS_DIR / f"{CURRENT_DATE}.wav"
|