Audio & Images
Audio
Transcription (Speech-to-Text)
from djangosdk.audio.transcribe import transcribe, atranscribe
# Synchronous
transcript = transcribe("/path/to/audio.mp3", model="whisper-1")
print(transcript.text)
# Async
transcript = await atranscribe("/path/to/audio.mp3")Synthesis (Text-to-Speech)
from djangosdk.audio.synthesize import synthesize, asynthesize
audio_bytes = synthesize(
"Hello, how can I help you today?",
model="tts-1",
voice="alloy",
)
with open("output.mp3", "wb") as f:
f.write(audio_bytes)In a Django View
Images
Image Generation
In a Django View
Configuration
Last updated
Was this helpful?