Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

talk/talk-llama: add basic example script for eleven-labs tts #728

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/talk-llama/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
eleven-labs.py
audio.mp3
23 changes: 23 additions & 0 deletions examples/talk-llama/eleven-labs.py
Original file line number Diff line number Diff line change
@@ -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")
1 change: 1 addition & 0 deletions examples/talk-llama/speak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/talk/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eleven-labs.py
audio.mp3
23 changes: 23 additions & 0 deletions examples/talk/eleven-labs.py
Original file line number Diff line number Diff line change
@@ -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")
1 change: 1 addition & 0 deletions examples/talk/speak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down