DGdev91 commited on
Commit
5039d82
·
unverified ·
1 Parent(s): a7879d3

talk, talk-llama : add basic example script for eleven-labs tts (#728)

Browse files
examples/talk-llama/.gitignore CHANGED
@@ -1,2 +1 @@
1
- eleven-labs.py
2
  audio.mp3
 
 
1
  audio.mp3
examples/talk-llama/eleven-labs.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import importlib.util
3
+
4
+ api_key = "" #Write your https://beta.elevenlabs.io api key here
5
+ if not api_key:
6
+ 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")
7
+ sys.exit()
8
+
9
+ if importlib.util.find_spec("elevenlabs") is None:
10
+ print("elevenlabs library is not installed, you can install it to your enviroment using 'pip install elevenlabs'")
11
+ sys.exit()
12
+
13
+ from elevenlabs import ElevenLabs
14
+ eleven = ElevenLabs(api_key)
15
+
16
+ # Get a Voice object, by name or UUID
17
+ voice = eleven.voices["Arnold"] #Possible Voices: Adam Antoni Arnold Bella Domi Elli Josh
18
+
19
+ # Generate the TTS
20
+ audio = voice.generate(str(sys.argv[2:]))
21
+
22
+ # Save the TTS to a file
23
+ audio.save("audio")
examples/talk-llama/speak.sh CHANGED
@@ -13,6 +13,7 @@
13
  say "$2"
14
 
15
  # Eleven Labs
 
16
  #
17
  #wd=$(dirname $0)
18
  #script=$wd/eleven-labs.py
 
13
  say "$2"
14
 
15
  # Eleven Labs
16
+ # 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
17
  #
18
  #wd=$(dirname $0)
19
  #script=$wd/eleven-labs.py
examples/talk/.gitignore CHANGED
@@ -1 +1 @@
1
- eleven-labs.py
 
1
+ audio.mp3
examples/talk/eleven-labs.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import importlib.util
3
+
4
+ api_key = "" #Write your https://beta.elevenlabs.io api key here
5
+ if not api_key:
6
+ 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")
7
+ sys.exit()
8
+
9
+ if importlib.util.find_spec("elevenlabs") is None:
10
+ print("elevenlabs library is not installed, you can install it to your enviroment using 'pip install elevenlabs'")
11
+ sys.exit()
12
+
13
+ from elevenlabs import ElevenLabs
14
+ eleven = ElevenLabs(api_key)
15
+
16
+ # Get a Voice object, by name or UUID
17
+ voice = eleven.voices["Arnold"] #Possible Voices: Adam Antoni Arnold Bella Domi Elli Josh
18
+
19
+ # Generate the TTS
20
+ audio = voice.generate(str(sys.argv[2:]))
21
+
22
+ # Save the TTS to a file
23
+ audio.save("audio")
examples/talk/speak.sh CHANGED
@@ -13,6 +13,7 @@
13
  say "$2"
14
 
15
  # Eleven Labs
 
16
  #
17
  #wd=$(dirname $0)
18
  #script=$wd/eleven-labs.py
 
13
  say "$2"
14
 
15
  # Eleven Labs
16
+ # 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
17
  #
18
  #wd=$(dirname $0)
19
  #script=$wd/eleven-labs.py