MockInterviewBot / elevenLabs.py
nsgupta1's picture
Modularize (#2)
1018204 verified
from elevenlabs import ElevenLabs
# Initialize the ElevenLabs client with your API key
client = ElevenLabs(api_key="YOUR_API_KEY")
# Generate audio from text
audio = client.generate(
text="Welcome to your mock interview. Let's start with your first question.",
voice="Rachel", # Choose a pre-existing voice or create a custom voice
model="eleven_monolingual_v1" # Use the English-optimized model
)
# Save the generated audio to a file
with open("output.mp3", "wb") as f:
f.write(audio)