Quick Start
Get up and running with LattifAI SDK in 5 minutes
Quick Start
Get LattifAI running in just a few minutes.
Prerequisites
- Python 3.10 or higher
- A LattifAI API Key
Installation
pip install lattifaiOr using uv (recommended for faster installation):
uv pip install lattifaiSet Your API Key
export LATTIFAI_API_KEY="lf_your_api_key_here"Python SDK - 5 Lines of Code
from lattifai import LattifAI
client = LattifAI()
caption = client.alignment(
input_media="audio.wav",
input_caption="subtitle.srt",
output_caption_path="aligned.srt",
)That's it! Your aligned subtitles are saved to aligned.srt.
Command Line Interface
# Align local audio with subtitle
lai alignment align audio.wav subtitle.srt output.srt
# Download and align YouTube video
lai alignment youtube "https://youtube.com/watch?v=VIDEO_ID"Access Results
# Access alignment results
for segment in caption.supervisions:
print(f"{segment.start:.2f}s - {segment.end:.2f}s: {segment.text}")