diff --git a/OS/01/start.sh b/OS/01/start.sh index 8a4dcc6..0ff76f0 100755 --- a/OS/01/start.sh +++ b/OS/01/start.sh @@ -1,9 +1,11 @@ ### SETTINGS # If ALL_LOCAL is False, we'll use OpenAI's services -# If setting ALL_LOCAL to true, set the path to the WHISPER local model +# else we use whisper.cpp and piper local models export ALL_LOCAL=False -# export WHISPER_MODEL_PATH=... +export WHISPER_MODEL_NAME="ggml-tiny.en.bin" + +# Set the OpenAI API key for OpenInterpreter to work # export OPENAI_API_KEY=sk-... # For TTS, we use the en_US-lessac-medium voice model by default @@ -32,6 +34,11 @@ export LOG_LEVEL="INFO" ### SETUP # if using local models, install the models / executables +WHISPER_MODEL_URL="https://huggingface.co/ggerganov/whisper.cpp/resolve/main/" +WHISPER_RUST_PATH="`pwd`/local_stt/whisper-rust" + +curl -OL "${WHISPER_MODEL_URL}${WHISPER_MODEL_NAME}" --output-dir ${WHISPER_RUST_PATH} + if [[ "$ALL_LOCAL" == "True" ]]; then OS=$(uname -s) ARCH=$(uname -m) diff --git a/OS/01/stt.py b/OS/01/stt.py index aa14e24..48f0ed6 100644 --- a/OS/01/stt.py +++ b/OS/01/stt.py @@ -53,13 +53,14 @@ def run_command(command): return result.stdout, result.stderr def get_transcription_file(wav_file_path: str): - model_path = os.getenv("WHISPER_MODEL_PATH") - if not model_path: - raise EnvironmentError("WHISPER_MODEL_PATH environment variable is not set.") + whisper_rust_path = os.path.join(os.path.dirname(__file__), 'local_stt', 'whisper-rust') + model_name = os.getenv('WHISPER_MODEL_NAME') + if not model_name: + raise EnvironmentError("WHISPER_MODEL_NAME environment variable is not set.") output, error = run_command([ - os.path.join(os.path.dirname(__file__), 'local_stt', 'whisper-rust', 'whisper-rust'), - '--model-path', model_path, + os.path.join(whisper_rust_path, 'whisper-rust'), + '--model-path', os.path.join(whisper_rust_path, model_name), '--file-path', wav_file_path ])