Skip to content

Update examples and readme#19

Open
divyam-camb wants to merge 8 commits into
Camb-ai:mainfrom
divyam-camb:update-examples-and-readme
Open

Update examples and readme#19
divyam-camb wants to merge 8 commits into
Camb-ai:mainfrom
divyam-camb:update-examples-and-readme

Conversation

@divyam-camb
Copy link
Copy Markdown

No description provided.

Comment thread examples/baseten_provider_example.py Outdated
Comment on lines +10 to +17
api_key = os.environ["BASETEN_API_KEY"]
mars_url = os.getenv("BASETEN_MARS_URL") or os.getenv("BASETEN_MARS_PRO_URL")
ref_path = os.getenv("BASETEN_REFERENCE_AUDIO_PATH", "audio.wav")

client = CambAI(
tts_provider="baseten",
provider_params={"api_key": api_key, "mars_url": mars_url},
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u keep it in global like before? it is like that for a reason -- for more clarity
also client is usually kept global so that same instance can be called by multiple users

def main() -> None:
client = CambAI(api_key=os.environ["CAMB_API_KEY"])
response = client.dub.create_dub(
video_url="https://www.youtube.com/...link...",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can keep like before, no need of env

Comment thread examples/perform_dubbing.py Outdated
)
task_id = response.task_id
print(f"Dub Task created with ID: {task_id}")
assert task_id is not None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add print back pls

Comment thread examples/perform_dubbing.py Outdated
break
time.sleep(5)
info = client.dub.get_dubbed_run_info(status_response.run_id)
if info.video_url:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just print it no? worst case, null will be printed

Comment thread examples/story.py Outdated


def main() -> None:
client = CambAI(api_key=os.environ["CAMB_API_KEY"])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public client pls

Comment thread examples/story.py Outdated

def main() -> None:
client = CambAI(api_key=os.environ["CAMB_API_KEY"])
with open(os.environ["STORY_FILE_PATH"], "rb") as f:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just create a small "resources subfolder" and add a path to that file.

Also same for title, too much dependency on os.environ, we do not need to store anything in the env

Comment thread examples/text_to_audio.py Outdated
def test_text_to_audio():
# Note: audio_type values are "sound" or "music"
def main() -> None:
client = CambAI(api_key=os.environ["CAMB_API_KEY"])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public is gud

Comment thread examples/text_to_voice.py
Comment on lines +10 to +31
SPEECH_TEXT = (
"Good evening. Tonight, the city sleeps under a thin veil of rain, "
"and every streetlight looks like a small sun trapped in glass. "
"If you listen closely, you can hear the rhythm of footsteps fading "
"into the distance—steady, unhurried, almost like a heartbeat. "
"Somewhere, a clock strikes the hour, and for a moment, everything feels still."
)

VOICE_DESCRIPTION = (
"Adult male, late 30s to early 40s, North American accent with a neutral, "
"broadcast-quality tone. Deep, warm baritone with smooth resonance and clear "
"diction. Pace is measured and unhurried, with gentle pauses at commas and "
"a slight lift at the end of reflective sentences. Delivery is calm, intimate, "
"and slightly wistful—like a late-night radio host reading poetry, not "
"performing for a crowd. Low breath noise, minimal sibilance, consistent volume, "
"and a soft, natural smile in the voice without sounding cheerful or salesy."
)


def main() -> None:
client = CambAI(api_key=os.environ["PROD"])
create_out = client.text_to_voice.create_text_to_voice(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, the request fails if the description is short. So we're just fast forwarding the process for the user so that they can just run snippet

Comment thread README.md Outdated
Comment on lines +246 to +121
status_response = client.dub.get_dubbing_status(task_id=task_id)
print(f"Current Status: {status_response.status}")
if status_response.status == "SUCCESS":
dubbed_run_info = client.dub.get_dubbed_run_info(status_response.run_id)
print(f"Dubbed Video URL: {dubbed_run_info.audio_url}")
print(f"Dubbed Video URL: {dubbed_run_info.transcript}")
print(f"Dubbed Video URL: {dubbed_run_info.video_url}")
status = client.dub.get_dubbing_status(task_id=task_id)
if status.status == "SUCCESS":
info = client.dub.get_dubbed_run_info(status.run_id)
print(info.video_url or info.audio_url)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont see a reason for this change..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants