naso / agents /voiceover_agent.py
mgbam's picture
Update agents/voiceover_agent.py
af2fe4e verified
raw
history blame
585 Bytes
class VoiceoverAgent:
def __init__(self):
self.api_key = os.getenv("ELEVENLABS_API_KEY")
def generate_voiceover(self, text):
if not self.api_key:
return None
try:
response = requests.post(
"https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM",
headers={"xi-api-key": self.api_key},
json={"text": text, "voice_settings": {"stability": 0.7, "similarity_boost": 0.8}}
)
return response.content
except:
return None