diff --git a/examples/talk-llama/.gitignore b/examples/talk-llama/.gitignore index 6b780a24..cbf36313 100644 --- a/examples/talk-llama/.gitignore +++ b/examples/talk-llama/.gitignore @@ -1,2 +1 @@ -eleven-labs.py audio.mp3 diff --git a/examples/talk-llama/eleven-labs.py b/examples/talk-llama/eleven-labs.py new file mode 100644 index 00000000..56855fb3 --- /dev/null +++ b/examples/talk-llama/eleven-labs.py @@ -0,0 +1,23 @@ +import sys +import importlib.util + +api_key = "" #Write your https://beta.elevenlabs.io api key here +if not api_key: + print("To use elevenlabs you have to register to https://beta.elevenlabs.io and add your elevenlabs api key to examples/talk-llama/eleven-labs.py") + sys.exit() + +if importlib.util.find_spec("elevenlabs") is None: + print("elevenlabs library is not installed, you can install it to your enviroment using 'pip install elevenlabs'") + sys.exit() + +from elevenlabs import ElevenLabs +eleven = ElevenLabs(api_key) + +# Get a Voice object, by name or UUID +voice = eleven.voices["Arnold"] #Possible Voices: Adam Antoni Arnold Bella Domi Elli Josh + +# Generate the TTS +audio = voice.generate(str(sys.argv[2:])) + +# Save the TTS to a file +audio.save("audio") diff --git a/examples/talk-llama/speak.sh b/examples/talk-llama/speak.sh index 8888a206..62982a30 100755 --- a/examples/talk-llama/speak.sh +++ b/examples/talk-llama/speak.sh @@ -13,6 +13,7 @@ say "$2" # Eleven Labs +# To use it, install the elevenlabs module from pip (pip install elevenlabs), register to https://beta.elevenlabs.io to get an api key and paste it in /examples/talk-llama/eleven-labs.py # #wd=$(dirname $0) #script=$wd/eleven-labs.py diff --git a/examples/talk/.gitignore b/examples/talk/.gitignore index 67403ae5..cbf36313 100644 --- a/examples/talk/.gitignore +++ b/examples/talk/.gitignore @@ -1 +1 @@ -eleven-labs.py +audio.mp3 diff --git a/examples/talk/eleven-labs.py b/examples/talk/eleven-labs.py new file mode 100644 index 00000000..6a4e8db0 --- /dev/null +++ b/examples/talk/eleven-labs.py @@ -0,0 +1,23 @@ +import sys +import importlib.util + +api_key = "" #Write your https://beta.elevenlabs.io api key here +if not api_key: + print("To use elevenlabs you have to register to https://beta.elevenlabs.io and add your elevenlabs api key to examples/talk/eleven-labs.py") + sys.exit() + +if importlib.util.find_spec("elevenlabs") is None: + print("elevenlabs library is not installed, you can install it to your enviroment using 'pip install elevenlabs'") + sys.exit() + +from elevenlabs import ElevenLabs +eleven = ElevenLabs(api_key) + +# Get a Voice object, by name or UUID +voice = eleven.voices["Arnold"] #Possible Voices: Adam Antoni Arnold Bella Domi Elli Josh + +# Generate the TTS +audio = voice.generate(str(sys.argv[2:])) + +# Save the TTS to a file +audio.save("audio") diff --git a/examples/talk/speak.sh b/examples/talk/speak.sh index 3743a380..e03786e9 100755 --- a/examples/talk/speak.sh +++ b/examples/talk/speak.sh @@ -13,6 +13,7 @@ say "$2" # Eleven Labs +# To use it, install the elevenlabs module from pip (pip install elevenlabs), register to https://beta.elevenlabs.io to get an api key and paste it in /examples/talk/eleven-labs.py # #wd=$(dirname $0) #script=$wd/eleven-labs.py