smallestai 1.3.1__tar.gz → 1.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of smallestai might be problematic. Click here for more details.
- {smallestai-1.3.1 → smallestai-1.3.3}/PKG-INFO +3 -3
- {smallestai-1.3.1 → smallestai-1.3.3}/README.md +2 -2
- {smallestai-1.3.1 → smallestai-1.3.3}/pyproject.toml +1 -1
- {smallestai-1.3.1 → smallestai-1.3.3}/smallest/utils.py +4 -3
- {smallestai-1.3.1 → smallestai-1.3.3}/smallestai.egg-info/PKG-INFO +3 -3
- {smallestai-1.3.1 → smallestai-1.3.3}/LICENSE +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/setup.cfg +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallest/__init__.py +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallest/async_tts.py +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallest/exceptions.py +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallest/models.py +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallest/stream_tts.py +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallest/tts.py +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallestai.egg-info/SOURCES.txt +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallestai.egg-info/dependency_links.txt +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallestai.egg-info/requires.txt +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/smallestai.egg-info/top_level.txt +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/tests/test_async.py +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/tests/test_sync.py +0 -0
- {smallestai-1.3.1 → smallestai-1.3.3}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: smallestai
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Official Python client for the Smallest AI API
|
|
5
5
|
Author-email: Smallest <info@smallest.ai>
|
|
6
6
|
License: MIT
|
|
@@ -147,9 +147,9 @@ if __name__ == "__main__":
|
|
|
147
147
|
- `speed`: Speech speed multiplier (default: 1.0)
|
|
148
148
|
- `add_wav_header`: Include WAV header in output (default: True)
|
|
149
149
|
- `transliterate`: Enable text transliteration (default: False)
|
|
150
|
-
- `remove_extra_silence`: Remove additional silence (default: True)
|
|
150
|
+
- `remove_extra_silence`: Remove additional silence (default: True)
|
|
151
151
|
|
|
152
|
-
These parameters are part of the `AsyncSmallest` instance. They can be set when creating the instance (as shown above). However, the `synthesize` function also accepts `kwargs`, allowing you to override any of these parameters on a per-request basis.
|
|
152
|
+
These parameters are part of the `AsyncSmallest` instance. They can be set when creating the instance (as shown above). However, the `synthesize` function also accepts `kwargs`, allowing you to override any of these parameters on a per-request basis.
|
|
153
153
|
|
|
154
154
|
For example, you can modify the speech speed and sample rate just for a particular synthesis request:
|
|
155
155
|
```py
|
|
@@ -120,9 +120,9 @@ if __name__ == "__main__":
|
|
|
120
120
|
- `speed`: Speech speed multiplier (default: 1.0)
|
|
121
121
|
- `add_wav_header`: Include WAV header in output (default: True)
|
|
122
122
|
- `transliterate`: Enable text transliteration (default: False)
|
|
123
|
-
- `remove_extra_silence`: Remove additional silence (default: True)
|
|
123
|
+
- `remove_extra_silence`: Remove additional silence (default: True)
|
|
124
124
|
|
|
125
|
-
These parameters are part of the `AsyncSmallest` instance. They can be set when creating the instance (as shown above). However, the `synthesize` function also accepts `kwargs`, allowing you to override any of these parameters on a per-request basis.
|
|
125
|
+
These parameters are part of the `AsyncSmallest` instance. They can be set when creating the instance (as shown above). However, the `synthesize` function also accepts `kwargs`, allowing you to override any of these parameters on a per-request basis.
|
|
126
126
|
|
|
127
127
|
For example, you can modify the speech speed and sample rate just for a particular synthesis request:
|
|
128
128
|
```py
|
|
@@ -12,6 +12,7 @@ from .models import TTSModels, TTSLanguages, TTSVoices
|
|
|
12
12
|
|
|
13
13
|
API_BASE_URL = "https://waves-api.smallest.ai/api/v1"
|
|
14
14
|
SENTENCE_END_REGEX = re.compile(r'.*[-.—!?;:…\n]$')
|
|
15
|
+
CHUNK_SIZE = 250
|
|
15
16
|
SAMPLE_WIDTH = 2
|
|
16
17
|
CHANNELS = 1
|
|
17
18
|
|
|
@@ -59,7 +60,7 @@ def preprocess_text(text: str) -> str:
|
|
|
59
60
|
text = mpn.normalize(text)
|
|
60
61
|
return text.strip()
|
|
61
62
|
|
|
62
|
-
def split_into_chunks(
|
|
63
|
+
def split_into_chunks(text: str) -> List[str]:
|
|
63
64
|
"""
|
|
64
65
|
Splits the input text into chunks based on sentence boundaries
|
|
65
66
|
defined by SENTENCE_END_REGEX and the maximum chunk size.
|
|
@@ -76,7 +77,7 @@ def split_into_chunks(self, text: str) -> List[str]:
|
|
|
76
77
|
if SENTENCE_END_REGEX.match(current_chunk):
|
|
77
78
|
last_break_index = i
|
|
78
79
|
|
|
79
|
-
if len(current_chunk) >=
|
|
80
|
+
if len(current_chunk) >= CHUNK_SIZE:
|
|
80
81
|
if last_break_index > 0:
|
|
81
82
|
# Split at the last valid sentence boundary
|
|
82
83
|
chunk = text[:last_break_index + 1].strip()
|
|
@@ -91,7 +92,7 @@ def split_into_chunks(self, text: str) -> List[str]:
|
|
|
91
92
|
# No sentence boundary found, split at max length
|
|
92
93
|
current_chunk = current_chunk.replace("—", " ")
|
|
93
94
|
chunks.append(current_chunk.strip())
|
|
94
|
-
text = text[
|
|
95
|
+
text = text[CHUNK_SIZE:]
|
|
95
96
|
i = -1 # Reset index to process the remaining text
|
|
96
97
|
current_chunk = ""
|
|
97
98
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: smallestai
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Official Python client for the Smallest AI API
|
|
5
5
|
Author-email: Smallest <info@smallest.ai>
|
|
6
6
|
License: MIT
|
|
@@ -147,9 +147,9 @@ if __name__ == "__main__":
|
|
|
147
147
|
- `speed`: Speech speed multiplier (default: 1.0)
|
|
148
148
|
- `add_wav_header`: Include WAV header in output (default: True)
|
|
149
149
|
- `transliterate`: Enable text transliteration (default: False)
|
|
150
|
-
- `remove_extra_silence`: Remove additional silence (default: True)
|
|
150
|
+
- `remove_extra_silence`: Remove additional silence (default: True)
|
|
151
151
|
|
|
152
|
-
These parameters are part of the `AsyncSmallest` instance. They can be set when creating the instance (as shown above). However, the `synthesize` function also accepts `kwargs`, allowing you to override any of these parameters on a per-request basis.
|
|
152
|
+
These parameters are part of the `AsyncSmallest` instance. They can be set when creating the instance (as shown above). However, the `synthesize` function also accepts `kwargs`, allowing you to override any of these parameters on a per-request basis.
|
|
153
153
|
|
|
154
154
|
For example, you can modify the speech speed and sample rate just for a particular synthesis request:
|
|
155
155
|
```py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|