File size: 567 Bytes
d74244d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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