Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .trunk/.gitignore +9 -0
- .trunk/configs/.hadolint.yaml +3 -0
- .trunk/configs/.isort.cfg +2 -0
- .trunk/configs/.markdownlint.yaml +2 -0
- .trunk/configs/.yamllint.yaml +7 -0
- .trunk/configs/ruff.toml +5 -0
- .trunk/trunk.yaml +38 -0
- src/vocalizr/model.py +5 -1
.trunk/.gitignore
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*out
|
2 |
+
*logs
|
3 |
+
*actions
|
4 |
+
*notifications
|
5 |
+
*tools
|
6 |
+
plugins
|
7 |
+
user_trunk.yaml
|
8 |
+
user.yaml
|
9 |
+
tmp
|
.trunk/configs/.hadolint.yaml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
trustedRegistries:
|
2 |
+
- docker.io
|
3 |
+
- ghcr.io
|
.trunk/configs/.isort.cfg
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[settings]
|
2 |
+
profile=black
|
.trunk/configs/.markdownlint.yaml
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# Prettier friendly markdownlint config (all formatting rules disabled)
|
2 |
+
extends: markdownlint/style/prettier
|
.trunk/configs/.yamllint.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
rules:
|
2 |
+
quoted-strings:
|
3 |
+
required: only-when-needed
|
4 |
+
extra-allowed: ["{|}"]
|
5 |
+
key-duplicates: {}
|
6 |
+
octal-values:
|
7 |
+
forbid-implicit-octal: true
|
.trunk/configs/ruff.toml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Generic, formatter-friendly config.
|
2 |
+
select = ["B", "D3", "E", "F"]
|
3 |
+
|
4 |
+
# Never enforce `E501` (line length violations). This should be handled by formatters.
|
5 |
+
ignore = ["E501"]
|
.trunk/trunk.yaml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
|
2 |
+
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
|
3 |
+
version: 0.1
|
4 |
+
cli:
|
5 |
+
version: 1.22.15
|
6 |
+
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
|
7 |
+
plugins:
|
8 |
+
sources:
|
9 |
+
- id: trunk
|
10 |
+
ref: v1.6.8
|
11 |
+
uri: https://github.com/trunk-io/plugins
|
12 |
+
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
|
13 |
+
runtimes:
|
14 |
+
enabled:
|
15 | |
16 | |
17 |
+
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
|
18 |
+
lint:
|
19 |
+
enabled:
|
20 | |
21 | |
22 | |
23 |
+
- git-diff-check
|
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 |
+
actions:
|
34 |
+
enabled:
|
35 |
+
- trunk-announce
|
36 |
+
- trunk-check-pre-push
|
37 |
+
- trunk-fmt-pre-commit
|
38 |
+
- trunk-upgrade-available
|
src/vocalizr/model.py
CHANGED
@@ -6,7 +6,7 @@ from loguru import logger
|
|
6 |
from numpy import float32
|
7 |
from numpy.typing import NDArray
|
8 |
from soundfile import write
|
9 |
-
|
10 |
from vocalizr import AUDIO_FILE_PATH, PIPELINE
|
11 |
|
12 |
|
@@ -80,6 +80,7 @@ def generate_audio_for_text(
|
|
80 |
generator: Generator[KPipeline.Result, None, None] = PIPELINE(
|
81 |
text=text, voice=voice, speed=speed
|
82 |
)
|
|
|
83 |
for _, _, audio in generator:
|
84 |
if audio is None or isinstance(audio, str):
|
85 |
logger.exception(f"Unexpected type (audio): {type(audio)}")
|
@@ -92,3 +93,6 @@ def generate_audio_for_text(
|
|
92 |
logger.info(f"Saving audio file at {AUDIO_FILE_PATH}")
|
93 |
save_file_wav(audio=audio_np)
|
94 |
yield 24000, audio_np
|
|
|
|
|
|
|
|
6 |
from numpy import float32
|
7 |
from numpy.typing import NDArray
|
8 |
from soundfile import write
|
9 |
+
from torch import zeros
|
10 |
from vocalizr import AUDIO_FILE_PATH, PIPELINE
|
11 |
|
12 |
|
|
|
80 |
generator: Generator[KPipeline.Result, None, None] = PIPELINE(
|
81 |
text=text, voice=voice, speed=speed
|
82 |
)
|
83 |
+
first = True
|
84 |
for _, _, audio in generator:
|
85 |
if audio is None or isinstance(audio, str):
|
86 |
logger.exception(f"Unexpected type (audio): {type(audio)}")
|
|
|
93 |
logger.info(f"Saving audio file at {AUDIO_FILE_PATH}")
|
94 |
save_file_wav(audio=audio_np)
|
95 |
yield 24000, audio_np
|
96 |
+
if first:
|
97 |
+
first = False
|
98 |
+
yield 24000, zeros(1).numpy()
|