cartesia 1.0.8__py2.py3-none-any.whl → 1.0.9__py2.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.
cartesia/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
- from cartesia.client import Cartesia, AsyncCartesia
1
+ from cartesia.client import AsyncCartesia, Cartesia
2
2
 
3
3
  __all__ = ["Cartesia", "AsyncCartesia"]
cartesia/_types.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from typing import List, TypedDict
2
+
2
3
  from cartesia.utils.deprecated import deprecated
3
4
 
4
5
 
cartesia/client.py CHANGED
@@ -1,46 +1,47 @@
1
1
  import asyncio
2
2
  import base64
3
- from collections import defaultdict
4
3
  import json
4
+ import logging
5
5
  import os
6
6
  import uuid
7
+ from collections import defaultdict
7
8
  from types import TracebackType
8
9
  from typing import (
9
10
  Any,
10
11
  AsyncGenerator,
11
- Iterator,
12
+ Callable,
12
13
  Dict,
13
14
  Generator,
15
+ Iterator,
14
16
  List,
15
17
  Optional,
18
+ Set,
16
19
  Tuple,
17
20
  Union,
18
- Callable,
19
- Set,
20
21
  )
21
22
 
22
23
  import aiohttp
23
24
  import httpx
24
- import logging
25
25
  import requests
26
+
26
27
  try:
27
28
  from websockets.sync.client import connect
29
+
28
30
  IS_WEBSOCKET_SYNC_AVAILABLE = True
29
31
  except ImportError:
30
32
  IS_WEBSOCKET_SYNC_AVAILABLE = False
31
33
 
32
- from iterators import TimeoutIterator
33
-
34
- from cartesia.utils.retry import retry_on_connection_error, retry_on_connection_error_async
35
34
  from cartesia._types import (
35
+ DeprecatedOutputFormatMapping,
36
36
  EventType,
37
37
  OutputFormat,
38
38
  OutputFormatMapping,
39
- DeprecatedOutputFormatMapping,
40
39
  VoiceControls,
41
40
  VoiceMetadata,
42
41
  )
43
-
42
+ from cartesia.utils.retry import retry_on_connection_error, retry_on_connection_error_async
43
+ from iterators import TimeoutIterator
44
+ from websockets.sync.client import connect
44
45
 
45
46
  DEFAULT_MODEL_ID = "sonic-english" # latest default model
46
47
  MULTILINGUAL_MODEL_ID = "sonic-multilingual" # latest multilingual model
@@ -212,21 +213,22 @@ class Voices(Resource):
212
213
 
213
214
  return response.json()
214
215
 
215
- def clone(self, filepath: Optional[str] = None, link: Optional[str] = None) -> List[float]:
216
+ def clone(self, filepath: Optional[str] = None, enhance: str = True) -> List[float]:
216
217
  """Clone a voice from a clip.
217
218
 
218
219
  Args:
219
220
  filepath: The path to the clip file.
221
+ enhance: Whether to enhance the clip before cloning the voice (highly recommended). Defaults to True.
220
222
 
221
223
  Returns:
222
224
  The embedding of the cloned voice as a list of floats.
223
225
  """
224
- # TODO: Python has a bytes object, use that instead of a filepath
225
226
  if not filepath:
226
227
  raise ValueError("Filepath must be specified.")
227
228
  url = f"{self._http_url()}/voices/clone/clip"
228
229
  with open(filepath, "rb") as file:
229
230
  files = {"clip": file}
231
+ files["enhance"] = str(enhance).lower()
230
232
  headers = self.headers.copy()
231
233
  headers.pop("Content-Type", None)
232
234
  response = httpx.post(url, headers=headers, files=files, timeout=self.timeout)
cartesia/utils/retry.py CHANGED
@@ -1,9 +1,9 @@
1
- import time
2
-
3
- from aiohttp.client_exceptions import ServerDisconnectedError
4
1
  import asyncio
2
+ import time
5
3
  from functools import wraps
6
4
  from http.client import RemoteDisconnected
5
+
6
+ from aiohttp.client_exceptions import ServerDisconnectedError
7
7
  from httpx import TimeoutException
8
8
  from requests.exceptions import ConnectionError
9
9
 
cartesia/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.0.8"
1
+ __version__ = "1.0.9"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cartesia
3
- Version: 1.0.8
3
+ Version: 1.0.9
4
4
  Summary: The official Python library for the Cartesia API.
5
5
  Home-page:
6
6
  Author: Cartesia, Inc.
@@ -0,0 +1,12 @@
1
+ cartesia/__init__.py,sha256=E4w7psbAwx8X6Iri3W8jGeo11gIlhr3mSU33zChipmI,93
2
+ cartesia/_types.py,sha256=rISSd6sfne6awLDoonqA9KlE0fVQZdIaGjxsvHTFBlE,4407
3
+ cartesia/client.py,sha256=m6eVIr5AL0Xuwh7707jXMNIxx1CAseW03xvgbbuNNsU,51613
4
+ cartesia/version.py,sha256=q2ACMkQx0Hm5xKo2YKJFBE7rTruciTSIN6AvWWL9nB8,22
5
+ cartesia/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ cartesia/utils/deprecated.py,sha256=2cXvGtrxhPeUZA5LWy2n_U5OFLDv7SHeFtzqhjSJGyk,1674
7
+ cartesia/utils/retry.py,sha256=O6fyVWpH9Su8c0Fwupl57xMt6JrwJ52txBwP3faUL7k,3339
8
+ cartesia-1.0.9.dist-info/LICENSE.md,sha256=PT2YG5wEtEX1TNDn5sXkUXqbn-neyr7cZenTxd40ql4,1074
9
+ cartesia-1.0.9.dist-info/METADATA,sha256=C2htRYPEJuve-EhP1R7dazFxnBSJrCTnESIIDBx5vBk,21137
10
+ cartesia-1.0.9.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
11
+ cartesia-1.0.9.dist-info/top_level.txt,sha256=rTX4HnnCegMxl1FK9czpVC7GAvf3SwDzPG65qP-BS4w,9
12
+ cartesia-1.0.9.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- cartesia/__init__.py,sha256=jMIf2O7dTGxvTA5AfXtmh1H_EGfMtQseR5wXrjNRbLs,93
2
- cartesia/_types.py,sha256=Lcp4GOot5UfI0EveDi2QdNALMo1rK4PwUrtMvW5P6vY,4406
3
- cartesia/client.py,sha256=gOH3ddVI-epHbPGijM3jExSmMOZm8TiyOfZlLKWt89w,51485
4
- cartesia/version.py,sha256=NND_6JDYnYnGzN3-RTpS5F7wzv62vDf7hAxiyTSBJfE,22
5
- cartesia/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- cartesia/utils/deprecated.py,sha256=2cXvGtrxhPeUZA5LWy2n_U5OFLDv7SHeFtzqhjSJGyk,1674
7
- cartesia/utils/retry.py,sha256=nuwWRfu3MOVTxIQMLjYf6WLaxSlnu_GdE3QjTV0zisQ,3339
8
- cartesia-1.0.8.dist-info/LICENSE.md,sha256=PT2YG5wEtEX1TNDn5sXkUXqbn-neyr7cZenTxd40ql4,1074
9
- cartesia-1.0.8.dist-info/METADATA,sha256=83WFXYyycaZfvqX_bdyctzx270x1PMYlC-5lUUcMVDs,21137
10
- cartesia-1.0.8.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
11
- cartesia-1.0.8.dist-info/top_level.txt,sha256=rTX4HnnCegMxl1FK9czpVC7GAvf3SwDzPG65qP-BS4w,9
12
- cartesia-1.0.8.dist-info/RECORD,,