smallestai 0.1.0__py3-none-any.whl → 1.2.0__py3-none-any.whl
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.
- smallest/tts.py +6 -1
- {smallestai-0.1.0.dist-info → smallestai-1.2.0.dist-info}/METADATA +11 -19
- {smallestai-0.1.0.dist-info → smallestai-1.2.0.dist-info}/RECORD +6 -6
- {smallestai-0.1.0.dist-info → smallestai-1.2.0.dist-info}/LICENSE +0 -0
- {smallestai-0.1.0.dist-info → smallestai-1.2.0.dist-info}/WHEEL +0 -0
- {smallestai-0.1.0.dist-info → smallestai-1.2.0.dist-info}/top_level.txt +0 -0
smallest/tts.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import wave
|
|
2
3
|
import copy
|
|
3
4
|
import requests
|
|
4
5
|
from typing import Optional, Union, List
|
|
@@ -128,7 +129,11 @@ class Smallest:
|
|
|
128
129
|
with open(save_as, "wb") as wf:
|
|
129
130
|
wf.write(audio_content)
|
|
130
131
|
else:
|
|
131
|
-
|
|
132
|
+
with wave.open(save_as, "wb") as wf:
|
|
133
|
+
wf.setnchannels(1)
|
|
134
|
+
wf.setsampwidth(2)
|
|
135
|
+
wf.setframerate(self.opts.sample_rate)
|
|
136
|
+
wf.writeframes(audio_content)
|
|
132
137
|
return None
|
|
133
138
|
|
|
134
139
|
return audio_content
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: smallestai
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Official Python client for the Smallest AI API
|
|
5
5
|
Author-email: Smallest <info@smallest.ai>
|
|
6
6
|
License: MIT
|
|
@@ -62,18 +62,12 @@ Currently, the library supports direct synthesis and the ability to synthesize s
|
|
|
62
62
|
|
|
63
63
|
## Installation
|
|
64
64
|
|
|
65
|
-
To install the
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
2. Navigate to the cloned directory and install the package:
|
|
73
|
-
```bash
|
|
74
|
-
cd smallest-python
|
|
75
|
-
pip install .
|
|
76
|
-
```
|
|
65
|
+
To install the latest version available
|
|
66
|
+
```bash
|
|
67
|
+
pip install smallestai
|
|
68
|
+
```
|
|
69
|
+
When using an SDK in your application, make sure to pin to at least the major version (e.g., ==1.*). This helps ensure your application remains stable and avoids potential issues from breaking changes in future updates.
|
|
70
|
+
|
|
77
71
|
|
|
78
72
|
## Get the API Key
|
|
79
73
|
|
|
@@ -94,9 +88,7 @@ from smallest import Smallest
|
|
|
94
88
|
|
|
95
89
|
def main():
|
|
96
90
|
client = Smallest(api_key=os.environ.get("SMALLEST_API_KEY"))
|
|
97
|
-
|
|
98
|
-
with open("sync_synthesize.wav", "wb") as f:
|
|
99
|
-
f.write(audio_data)
|
|
91
|
+
client.synthesize("Hello, this is a test for sync synthesis function.", save_as="sync_synthesize.wav")
|
|
100
92
|
|
|
101
93
|
if __name__ == "__main__":
|
|
102
94
|
main()
|
|
@@ -113,7 +105,7 @@ if __name__ == "__main__":
|
|
|
113
105
|
- `remove_extra_silence`: Remove additional silence (default: True)
|
|
114
106
|
|
|
115
107
|
### Async
|
|
116
|
-
|
|
108
|
+
Asynchronous text-to-speech synthesis client.
|
|
117
109
|
|
|
118
110
|
**Basic Usage:**
|
|
119
111
|
```python
|
|
@@ -126,9 +118,9 @@ client = AsyncSmallest(api_key=os.environ.get("SMALLEST_API_KEY"))
|
|
|
126
118
|
|
|
127
119
|
async def main():
|
|
128
120
|
async with client as tts:
|
|
129
|
-
audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
|
|
121
|
+
audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
|
|
130
122
|
async with aiofiles.open("async_synthesize.wav", "wb") as f:
|
|
131
|
-
await f.write(audio_bytes)
|
|
123
|
+
await f.write(audio_bytes) # alternatively you can use the `save_as` parameter.
|
|
132
124
|
|
|
133
125
|
if __name__ == "__main__":
|
|
134
126
|
asyncio.run(main())
|
|
@@ -3,10 +3,10 @@ smallest/async_tts.py,sha256=w_SY1Oetn5Zorq-8JXA7lGeRHR3kTtBzqotc_hF0hOQ,6010
|
|
|
3
3
|
smallest/exceptions.py,sha256=41GLVvNTfRQMQsPLGk0lHuhK2mak8_dVtiFLEtT23Dc,333
|
|
4
4
|
smallest/models.py,sha256=R5UZZA9SibrJ2DsWPi_mkKI13WfyC-MLd-7kptfjns4,390
|
|
5
5
|
smallest/stream_tts.py,sha256=1j4JpAwrAmwprC98mKQwuhXf0HFxFTlMcZ3_JAdcAK0,5416
|
|
6
|
-
smallest/tts.py,sha256=
|
|
6
|
+
smallest/tts.py,sha256=2v6kBPC_hocWdvt2Uua2aQgzg3BKQGIFXpq2DZMz9aA,5540
|
|
7
7
|
smallest/utils.py,sha256=hAgyEfZEnvayzu8qS4LXhpZR8qK7z4gatLWGVOkS3Yg,2183
|
|
8
|
-
smallestai-
|
|
9
|
-
smallestai-
|
|
10
|
-
smallestai-
|
|
11
|
-
smallestai-
|
|
12
|
-
smallestai-
|
|
8
|
+
smallestai-1.2.0.dist-info/LICENSE,sha256=kK3HNKhN7luQhkjkNWIvy9_gizbEDUM4mSv_HWq9uuM,1068
|
|
9
|
+
smallestai-1.2.0.dist-info/METADATA,sha256=qsNxKNN-KNTshjeBBh9AhS_yeYzlHEqPlt_9zuV2fGY,8717
|
|
10
|
+
smallestai-1.2.0.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
|
11
|
+
smallestai-1.2.0.dist-info/top_level.txt,sha256=i5ktbWkG-2aS28vrYTeuhKtA-tY2ZG7SHgLHi87QTLw,9
|
|
12
|
+
smallestai-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|