]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
talk, talk-llama : add basic example script for eleven-labs tts (#728)
authorDGdev91 <redacted>
Fri, 14 Apr 2023 16:53:58 +0000 (18:53 +0200)
committerGitHub <redacted>
Fri, 14 Apr 2023 16:53:58 +0000 (19:53 +0300)
examples/talk-llama/.gitignore
examples/talk-llama/eleven-labs.py [new file with mode: 0644]
examples/talk-llama/speak.sh
examples/talk/.gitignore
examples/talk/eleven-labs.py [new file with mode: 0644]
examples/talk/speak.sh

index 6b780a24045c9db63bc3a99083fa8f23509b0445..cbf363136abcf678c10d35152b999545db9e394d 100644 (file)
@@ -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 (file)
index 0000000..56855fb
--- /dev/null
@@ -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") 
index 8888a206143159e3cb3828f7c1fd49584d3365da..62982a304de0c7a1ce54233bb0a92fef5b9705da 100755 (executable)
@@ -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
index 67403ae5dcaffe05328e581a1429945e60521bc6..cbf363136abcf678c10d35152b999545db9e394d 100644 (file)
@@ -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 (file)
index 0000000..6a4e8db
--- /dev/null
@@ -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") 
index 3743a38019083be657ad860f8942ceefe36edafa..e03786e955fddd0ebc33dcee8cb0b78b0f36f4c9 100755 (executable)
@@ -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