mgbam commited on
Commit
d74244d
·
verified ·
1 Parent(s): 1c240a6

Create agents/voiceover_agent.py

Browse files
Files changed (1) hide show
  1. agents/voiceover_agent.py +17 -0
agents/voiceover_agent.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # agents/voiceover_agent.py
2
+ import requests
3
+
4
+ class VoiceoverAgent:
5
+ def __init__(self, api_key=None):
6
+ self.api_key = api_key
7
+
8
+ def generate_voiceover(self, text):
9
+ if not self.api_key:
10
+ return b"" # Empty bytes if no key
11
+
12
+ response = requests.post(
13
+ "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM",
14
+ headers={"xi-api-key": self.api_key},
15
+ json={"text": text, "voice_settings": {"stability": 0.7, "similarity_boost": 0.8}}
16
+ )
17
+ return response.content