From b2b76702b3f110f1de9b6215b724bb2f233b35cc Mon Sep 17 00:00:00 2001 From: Gabor Cselle Date: Fri, 17 Nov 2023 10:50:12 -0800 Subject: [PATCH] Parametrize voice ID via another environment variable. --- README.md | 9 +++++++-- narrator.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 33f9b66..c10bdcb 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,19 @@ export OPENAI_API_KEY= export ELEVENLABS_API_KEY= ``` -Make a new voice in Eleven and get the voice id of that voice using their [get voices](https://elevenlabs.io/docs/api-reference/voices) API. +Make a new voice in Eleven and get the voice id of that voice using their [get voices](https://elevenlabs.io/docs/api-reference/voices) API, or by clicking the flask icon next to the voice in the VoiceLab tab. + +``` +export ELEVENLABS_VOICE_ID= +``` ## Run it! +In on terminal, run the webcam capture: ```bash python capture.py ``` -In one terminal. In the other, run the narrator: +In another terminal, run the narrator: ```bash python narrator.py diff --git a/narrator.py b/narrator.py index 0435b47..2c71038 100644 --- a/narrator.py +++ b/narrator.py @@ -24,7 +24,7 @@ def encode_image(image_path): def play_audio(text): - audio = generate(text=text, voice="ENfvYmv6CRqDodDZTieQ", model="eleven_turbo_v2") + audio = generate(text, voice=os.environ.get("ELEVENLABS_VOICE_ID")) unique_id = base64.urlsafe_b64encode(os.urandom(30)).decode("utf-8").rstrip("=") dir_path = os.path.join("narration", unique_id)