Skip to content

Commit 1a3d226

Browse files
Fixed Bugs
Signed-off-by: Saransh-Shankar <saransh.shankar@camb.ai>
1 parent 1a9acd0 commit 1a3d226

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Camb AI Python SDK 🎙️
22

3-
[![PyPI version](https://img.shields.io/pypi/v/camb-ai-sdk.svg?style=flat-square)](https://pypi.org/project/camb-ai-sdk/)
4-
[![License](https://img.shields.io/pypi/l/camb-ai-sdk.svg?style=flat-square)](https://github.com/your-org/camb-ai-python-sdk/blob/main/LICENSE)
5-
[![Build Status](https://img.shields.io/github/actions/workflow/status/your-org/camb-ai-python-sdk/ci.yml?branch=main&style=flat-square)](https://github.com/your-org/camb-ai-python-sdk/actions)
3+
[![PyPI version](https://img.shields.io/pypi/v/camb-sdk.svg?style=flat-square)](https://pypi.org/project/camb-sdk/)
4+
[![License](https://img.shields.io/pypi/l/camb-sdk.svg?style=flat-square)](https://github.com/Camb-ai/cambai-python-sdk/blob/master/LICENSE)
5+
[![Build Status](https://img.shields.io/github/actions/workflow/status/Camb-ai/cambai-python-sdk/ci.yml?branch=master&style=flat-square)](https://github.com/Camb-ai/cambai-python-sdk/actions)
66

77
The official Python SDK for interacting with Camb AI's powerful voice and audio generation APIs. Create expressive speech, unique voices, and rich soundscapes with just a few lines of Python.
88

cambai/api/apis_api.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import os
1414
import time
1515
import warnings
16+
import json
1617
# Constants for API operations
1718
TIMEOUT = 60
1819
POLL_INTERVAL = 5
@@ -68,8 +69,10 @@ def __init__(self, api_client=None, api_key: Optional[str] = None) -> None:
6869
configuration = Configuration()
6970
if api_key:
7071
configuration.api_key['APIKeyHeader'] = api_key
71-
else:
72+
elif os.environ.get("CAMB_API_KEY"):
7273
configuration.api_key['APIKeyHeader'] = os.environ.get("CAMB_API_KEY")
74+
else:
75+
raise ValueError("API key not provided. Please provide api_key or set CAMB_API_KEY environment variable.")
7376
api_client = ApiClient(configuration=configuration)
7477
self.api_client = api_client
7578

@@ -437,7 +440,6 @@ def end_to_end_dubbing(
437440
if verbose:
438441
print(f"Processing complete! Run ID: {result.run_id}")
439442
print("Retrieving dubbing result...")
440-
441443
response = self.get_dubbed_run_info_by_id(result.run_id)
442444
return response
443445

@@ -5087,10 +5089,14 @@ def get_dubbed_run_info_by_id(
50875089
_request_timeout=_request_timeout
50885090
)
50895091
response_data.read()
5090-
return self.api_client.response_deserialize(
5091-
response_data=response_data,
5092-
response_types_map=_response_types_map,
5093-
).data
5092+
raw_data = json.loads(response_data.data.decode('utf-8'))
5093+
5094+
from cambai.models.run_info_response import RunInfoResponse
5095+
return RunInfoResponse(
5096+
output_video_url=raw_data.get('video_url'),
5097+
output_audio_url=raw_data.get('audio_url'),
5098+
transcript=raw_data.get('transcript')
5099+
)
50945100

50955101

50965102
@validate_call

0 commit comments

Comments
 (0)