# agents/voiceover_agent.py | |
import requests | |
class VoiceoverAgent: | |
def __init__(self, api_key=None): | |
self.api_key = api_key | |
def generate_voiceover(self, text): | |
if not self.api_key: | |
return b"" # Empty bytes if no key | |
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 |