camb-sdk 1.0.2__py3-none-any.whl → 1.0.3__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 camb-sdk might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: camb-sdk
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Camb AI Python SDK for Text-to-Speech, Voice Generation, and Audio APIs
5
5
  Author-email: Camb AI <support@camb.ai>
6
6
  License: MIT
@@ -162,9 +162,10 @@ output_file = "generated_voice_output.mp3"
162
162
  try:
163
163
  print("Generating a new voice and speech...")
164
164
  # The 'text_to_voice' method returns a dict consisting of 3 sample URLs
165
+ # Description and Text should be atleast 100 Characters.
165
166
  result = client.text_to_voice(
166
- text="Crafting a unique voice with a hint of mystery and warmth.",
167
- voice_description="A smooth, baritone voice with a slight echo, perfect for storytelling.",
167
+ text="Crafting a truly unique and captivating voice that carries a subtle air of mystery, depth, and gentle warmth.",
168
+ voice_description="A smooth, rich baritone voice layered with a soft echo, ideal for immersive storytelling and emotional depth.",
168
169
  verbose=True
169
170
  )
170
171
  print(result)
@@ -190,7 +191,7 @@ output_file = "generated_sound_effect.mp3"
190
191
  try:
191
192
  print(f"Generating sound effect and saving to {output_file}...")
192
193
 
193
- client.text_to_audio(
194
+ client.text_to_sound(
194
195
  prompt="A gentle breeze rustling through autumn leaves in a quiet forest.",
195
196
  duration=10,
196
197
  save_to_file=output_file,
@@ -199,13 +200,13 @@ try:
199
200
  print(f"Success! Sound effect saved to {output_file}")
200
201
 
201
202
  except ApiException as e:
202
- print(f"API Exception when calling text_to_audio: {e}\n")
203
+ print(f"API Exception when calling text_to_sound: {e}\n")
203
204
  ```
204
205
 
205
206
  ---
206
- ### 4. End-to-End Dubbing
207
+ ### 4. Getting Client Source and Target Languages
207
208
 
208
- Dub videos into different languages with voice cloning and translation capabilities.
209
+ Retrieve available source and target languages for translation and dubbing.
209
210
 
210
211
  ```python
211
212
  from cambai import CambAI
@@ -214,12 +215,36 @@ from cambai.rest import ApiException
214
215
  # Initialize client
215
216
  client = CambAI(api_key="YOUR_CAMB_API_KEY")
216
217
 
217
- # Call all target languages
218
- print("Listing target languages...")
219
- target_languages = client.get_target_languages()
220
- print(f"Found {len(target_languages)} target languages:")
221
- for language in target_languages:
222
- print(f" - {language}")
218
+ try:
219
+ # Get all available target languages
220
+ print("Listing target languages...")
221
+ target_languages = client.get_target_languages()
222
+ print(f"Found {len(target_languages)} target languages:")
223
+ for language in target_languages:
224
+ print(f" - {language}")
225
+
226
+ # Get all available source languages
227
+ print("\nListing source languages...")
228
+ source_languages = client.get_source_languages()
229
+ print(f"Found {len(source_languages)} source languages:")
230
+ for language in source_languages:
231
+ print(f" - {language}")
232
+
233
+ except ApiException as e:
234
+ print(f"API Exception when getting languages: {e}\n")
235
+ ```
236
+
237
+ ---
238
+ ### 5. End-to-End Dubbing
239
+
240
+ Dub videos into different languages with voice cloning and translation capabilities.
241
+
242
+ ```python
243
+ from cambai import CambAI
244
+ from cambai.rest import ApiException
245
+
246
+ # Initialize client
247
+ client = CambAI(api_key="YOUR_CAMB_API_KEY")
223
248
 
224
249
  try:
225
250
  print("Starting end-to-end dubbing process...")
@@ -1,4 +1,4 @@
1
- camb_sdk-1.0.2.dist-info/licenses/LICENSE,sha256=wVE3pAs9Te7Joa1AmJJ0JVd8CNgNmslblQaNgbozkiU,1063
1
+ camb_sdk-1.0.3.dist-info/licenses/LICENSE,sha256=wVE3pAs9Te7Joa1AmJJ0JVd8CNgNmslblQaNgbozkiU,1063
2
2
  cambai/__init__.py,sha256=W459oGpo1ZtKXehhsAR0eLSAuqwm0nnmagAHaaXK_I8,7247
3
3
  cambai/api_client.py,sha256=YZhog2TzYjTilrhh3QV_mzZU3zdXA1fQcFXOiEYUNVs,27660
4
4
  cambai/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
@@ -7,7 +7,7 @@ cambai/exceptions.py,sha256=upZXBQh1bx93N8JIPJh89j67pArS4oxcCmZ_cfdK2XU,6471
7
7
  cambai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  cambai/rest.py,sha256=n3SSWXErpiSqlEvu6lEkTiJQLxjbrFkhZC1rF7biJJQ,9460
9
9
  cambai/api/__init__.py,sha256=IndnP-ftH1sQhRfojuX4VOhQ33JSFfGYP6Ns6YZ0y6k,460
10
- cambai/api/apis_api.py,sha256=HGvw6hLwNK26seunmW4Jqi9v4qk7OTB_bzsDCa2seN8,414750
10
+ cambai/api/apis_api.py,sha256=y29Dye7_V4frccYQJDhjhovMrqFLN5YUI6grCR-9coM,415198
11
11
  cambai/api/audio_separation_api.py,sha256=sN9JsmRsQIk6cAvVY5v5J52oKUcRVxysXfFJ0gwXZTE,32210
12
12
  cambai/api/dictionaries_api.py,sha256=2Sfhiy7hJg8_nyE2zj0jjaKhf4Ze2sWyYmmN1KDqYTU,10548
13
13
  cambai/api/dub_api.py,sha256=iWh7VvFGpqXEvfbpLgdeIavVHXKz5q4prDRLUNSMJLQ,36856
@@ -58,7 +58,7 @@ cambai/models/validation_error.py,sha256=Usdc8EC3OVyDc3KnPaQk_t6CUMVHUVrHltlbJv9
58
58
  cambai/models/validation_error_loc_inner.py,sha256=wHiW_qKw46E2pUdOnesgpdnuqpTX9IQTaEOVDgph5_E,4885
59
59
  cambai/models/video_output_type_without_avi.py,sha256=DvyuKHAv7K-Y_RbO-y2TDI4R7qbsEs_SE_g4f0CpSOs,792
60
60
  cambai/models/voice_item.py,sha256=V-7EmmVLFzISlu2xZVUfQuD-kOg-08DuGyePY7YyWK0,4070
61
- camb_sdk-1.0.2.dist-info/METADATA,sha256=vFt1FB7smT24aIzh4qgE2X-UfKDk0THKGjgAn9SP8ao,7751
62
- camb_sdk-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
- camb_sdk-1.0.2.dist-info/top_level.txt,sha256=iqT9vxFBtFsESik9PDn3hFfTRpAl_ULmIbRDX90XaY0,7
64
- camb_sdk-1.0.2.dist-info/RECORD,,
61
+ camb_sdk-1.0.3.dist-info/METADATA,sha256=6lnCgxngpw75Ua9lC3qZ8hywkzuykKA2i05t-lpqB0E,8576
62
+ camb_sdk-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
+ camb_sdk-1.0.3.dist-info/top_level.txt,sha256=iqT9vxFBtFsESik9PDn3hFfTRpAl_ULmIbRDX90XaY0,7
64
+ camb_sdk-1.0.3.dist-info/RECORD,,
cambai/api/apis_api.py CHANGED
@@ -15,7 +15,7 @@ import time
15
15
  import warnings
16
16
  import json
17
17
  # Constants for API operations
18
- TIMEOUT = 60
18
+ TIMEOUT = 120
19
19
  POLL_INTERVAL = 5
20
20
 
21
21
  from cambai.configuration import Configuration
@@ -74,7 +74,7 @@ class CambAI:
74
74
  self.api_client = api_client
75
75
 
76
76
  @validate_call
77
- def text_to_audio(
77
+ def text_to_sound(
78
78
  self,
79
79
  prompt: str,
80
80
  duration: int,
@@ -90,7 +90,7 @@ class CambAI:
90
90
  Args:
91
91
  prompt: The text prompt to convert to audio
92
92
  duration: The desired duration of the audio in seconds
93
- timeout: Maximum time to wait for processing in seconds (default: 60)
93
+ timeout: Maximum time to wait for processing in seconds (default: 120)
94
94
  save_to_file: Optional file path to save the audio to
95
95
  verbose: Whether to print status updates during processing
96
96
 
@@ -104,7 +104,7 @@ class CambAI:
104
104
  IOError: If there's an error saving the file
105
105
  """
106
106
  from cambai.models.create_text_to_audio_request_payload import CreateTextToAudioRequestPayload
107
-
107
+ assert(len(prompt) <= 30)
108
108
  # Create the request payload
109
109
  request_payload = CreateTextToAudioRequestPayload(
110
110
  prompt=prompt,
@@ -186,7 +186,7 @@ class CambAI:
186
186
  Args:
187
187
  text: The text to convert to speech
188
188
  voice_description: Description of the voice to generate
189
- timeout: Maximum time to wait for processing in seconds (default: 60)
189
+ timeout: Maximum time to wait for processing in seconds (default: 120)
190
190
  verbose: Whether to print status updates during processing
191
191
 
192
192
  Returns:
@@ -197,7 +197,7 @@ class CambAI:
197
197
  TimeoutError: If the processing doesn't complete within the timeout period
198
198
  """
199
199
  from cambai.models.create_text_to_voice_request_payload import CreateTextToVoiceRequestPayload
200
-
200
+ assert(len(text) >= 100)
201
201
  # Create the request payload
202
202
  request_payload = CreateTextToVoiceRequestPayload(
203
203
  text=text,
@@ -272,7 +272,7 @@ class CambAI:
272
272
  text: The text to convert to speech
273
273
  voice_id: The ID of the voice to use
274
274
  language: The language ID (default: 1)
275
- timeout: Maximum time to wait for processing in seconds (default: 60)
275
+ timeout: Maximum time to wait for processing in seconds (default: 120)
276
276
  output_type: Type of output to return (default: FILE_URL)
277
277
  save_to_file: Optional file path to save the audio to (works with BYTES output type)
278
278
  verbose: Whether to print status updates during processing
@@ -385,7 +385,7 @@ class CambAI:
385
385
  target_languages: The list of desired languages that the media file will be dubbed to
386
386
  selected_audio_tracks: Optional array of one or two zero-based audio track indices to dub. Only supported for MXF files. If omitted, the first audio track (index 0) is used by default.
387
387
  add_output_as_an_audio_track: Whether to add the output as an audio track in the MXF file. Only supported for MXF files.
388
- timeout: Maximum time to wait for processing in seconds (default: 60)
388
+ timeout: Maximum time to wait for processing in seconds (default: 180)
389
389
  verbose: Whether to print status updates during processing
390
390
 
391
391
  Returns:
@@ -440,6 +440,12 @@ class CambAI:
440
440
  response = self.get_dubbed_run_info_by_id(result.run_id)
441
441
  return response
442
442
 
443
+ elif result.status == 'FAILED' or result.status == 'ERROR':
444
+ error_msg = f"End-to-end dubbing failed with status: {result.status}"
445
+ if verbose:
446
+ print(error_msg)
447
+ raise RuntimeError(error_msg)
448
+
443
449
  elif verbose:
444
450
  print(f"Still processing... (status: {result.status})")
445
451
 
@@ -447,6 +453,8 @@ class CambAI:
447
453
  except Exception as e:
448
454
  if verbose:
449
455
  print(f"Error checking status: {str(e)}")
456
+ # Re-raise the exception to stop polling on error
457
+ raise
450
458
 
451
459
  # Wait before next poll
452
460
  time.sleep(POLL_INTERVAL)