1
0

Video generation pipelines files added

This commit is contained in:
Madina
2026-04-01 04:36:27 -07:00
commit de1bb5c23f
9 changed files with 569 additions and 0 deletions

35
generate_audios.py Normal file
View File

@@ -0,0 +1,35 @@
from elevenlabs.client import ElevenLabs
from elevenlabs.play import play
import os
import json
from dotenv import load_dotenv
load_dotenv()
ELEVENLABS_API_KEY = os.getenv('ELEVENLABS_API_KEY')
if __name__ == '__main__':
script_path = "reel_script.json"
with open(script_path, "r") as f:
reel_data = json.load(f)
client = ElevenLabs(
api_key=ELEVENLABS_API_KEY
)
for shot in reel_data["shots"]:
print(shot["shot_number"], shot["voiceover"])
prompt = shot["voiceover"]
audio = client.text_to_speech.convert(
text=prompt,
voice_id="JBFqnCBsd6RMkjVDRZzb",
model_id="eleven_multilingual_v2",
output_format="mp3_44100_128",
)
audio_bytes = b"".join(audio)
if not os.path.exists("audios"):
os.makedirs("audios")
with open(f"audios/output_{shot["shot_number"]}.mp3", "wb") as f:
f.write(audio_bytes)