Spaces:
Sleeping
Sleeping
from elevenlabslib import * | |
import os | |
def text2voice(prompt, path, key, voiceIndex): | |
user = ElevenLabsUser(key) | |
voice = user.get_available_voices()[voiceIndex] | |
audioBytes = voice.generate_audio_bytes(prompt) | |
with open(path, "wb") as binary_file: | |
binary_file.write(audioBytes) |