smallestai 1.1.0__tar.gz → 1.2.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smallestai
3
- Version: 1.1.0
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
@@ -88,9 +88,7 @@ from smallest import Smallest
88
88
 
89
89
  def main():
90
90
  client = Smallest(api_key=os.environ.get("SMALLEST_API_KEY"))
91
- audio_data = client.synthesize("Hello, this is a test for sync synthesis function.")
92
- with open("sync_synthesize.wav", "wb") as f:
93
- f.write(audio_data)
91
+ client.synthesize("Hello, this is a test for sync synthesis function.", save_as="sync_synthesize.wav")
94
92
 
95
93
  if __name__ == "__main__":
96
94
  main()
@@ -107,7 +105,7 @@ if __name__ == "__main__":
107
105
  - `remove_extra_silence`: Remove additional silence (default: True)
108
106
 
109
107
  ### Async
110
- A synchronous text-to-speech synthesis client.
108
+ Asynchronous text-to-speech synthesis client.
111
109
 
112
110
  **Basic Usage:**
113
111
  ```python
@@ -120,9 +118,9 @@ client = AsyncSmallest(api_key=os.environ.get("SMALLEST_API_KEY"))
120
118
 
121
119
  async def main():
122
120
  async with client as tts:
123
- 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.")
124
122
  async with aiofiles.open("async_synthesize.wav", "wb") as f:
125
- await f.write(audio_bytes)
123
+ await f.write(audio_bytes) # alternatively you can use the `save_as` parameter.
126
124
 
127
125
  if __name__ == "__main__":
128
126
  asyncio.run(main())
@@ -61,9 +61,7 @@ from smallest import Smallest
61
61
 
62
62
  def main():
63
63
  client = Smallest(api_key=os.environ.get("SMALLEST_API_KEY"))
64
- audio_data = client.synthesize("Hello, this is a test for sync synthesis function.")
65
- with open("sync_synthesize.wav", "wb") as f:
66
- f.write(audio_data)
64
+ client.synthesize("Hello, this is a test for sync synthesis function.", save_as="sync_synthesize.wav")
67
65
 
68
66
  if __name__ == "__main__":
69
67
  main()
@@ -80,7 +78,7 @@ if __name__ == "__main__":
80
78
  - `remove_extra_silence`: Remove additional silence (default: True)
81
79
 
82
80
  ### Async
83
- A synchronous text-to-speech synthesis client.
81
+ Asynchronous text-to-speech synthesis client.
84
82
 
85
83
  **Basic Usage:**
86
84
  ```python
@@ -93,9 +91,9 @@ client = AsyncSmallest(api_key=os.environ.get("SMALLEST_API_KEY"))
93
91
 
94
92
  async def main():
95
93
  async with client as tts:
96
- audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
94
+ audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
97
95
  async with aiofiles.open("async_synthesize.wav", "wb") as f:
98
- await f.write(audio_bytes)
96
+ await f.write(audio_bytes) # alternatively you can use the `save_as` parameter.
99
97
 
100
98
  if __name__ == "__main__":
101
99
  asyncio.run(main())
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "smallestai"
3
- version = "1.1.0"
3
+ version = "1.2.0"
4
4
  description = "Official Python client for the Smallest AI API"
5
5
  authors = [
6
6
  {name = "Smallest", email = "info@smallest.ai"},
@@ -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
- raise TTSError("WAV header is required for saving audio. Set 'add_wav_header=True' to add a WAV header.")
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: 1.1.0
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
@@ -88,9 +88,7 @@ from smallest import Smallest
88
88
 
89
89
  def main():
90
90
  client = Smallest(api_key=os.environ.get("SMALLEST_API_KEY"))
91
- audio_data = client.synthesize("Hello, this is a test for sync synthesis function.")
92
- with open("sync_synthesize.wav", "wb") as f:
93
- f.write(audio_data)
91
+ client.synthesize("Hello, this is a test for sync synthesis function.", save_as="sync_synthesize.wav")
94
92
 
95
93
  if __name__ == "__main__":
96
94
  main()
@@ -107,7 +105,7 @@ if __name__ == "__main__":
107
105
  - `remove_extra_silence`: Remove additional silence (default: True)
108
106
 
109
107
  ### Async
110
- A synchronous text-to-speech synthesis client.
108
+ Asynchronous text-to-speech synthesis client.
111
109
 
112
110
  **Basic Usage:**
113
111
  ```python
@@ -120,9 +118,9 @@ client = AsyncSmallest(api_key=os.environ.get("SMALLEST_API_KEY"))
120
118
 
121
119
  async def main():
122
120
  async with client as tts:
123
- 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.")
124
122
  async with aiofiles.open("async_synthesize.wav", "wb") as f:
125
- await f.write(audio_bytes)
123
+ await f.write(audio_bytes) # alternatively you can use the `save_as` parameter.
126
124
 
127
125
  if __name__ == "__main__":
128
126
  asyncio.run(main())
File without changes
File without changes
File without changes