diff --git a/01OS/01OS/server/stt/stt.py b/01OS/01OS/server/stt/stt.py index 9ee0999..2a57c9b 100644 --- a/01OS/01OS/server/stt/stt.py +++ b/01OS/01OS/server/stt/stt.py @@ -57,7 +57,7 @@ def run_command(command): def get_transcription_file(wav_file_path: str): local_path = os.path.join(os.path.dirname(__file__), 'local_service') - whisper_rust_path = os.path.join(os.path.dirname(__file__), 'whisper-rust') + whisper_rust_path = os.path.join(os.path.dirname(__file__), 'whisper-rust', 'target', 'release') model_name = os.getenv('WHISPER_MODEL_NAME') if not model_name: raise EnvironmentError("WHISPER_MODEL_NAME environment variable is not set.") diff --git a/01OS/01OS/server/stt/whisper-rust/README.md b/01OS/01OS/server/stt/whisper-rust/README.md deleted file mode 100644 index a4c8c02..0000000 --- a/01OS/01OS/server/stt/whisper-rust/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Setup - -To rebuild the `whisper-rust` executable, do the following: - -1. Install [Rust](https://www.rust-lang.org/tools/install), cmake, and Python dependencies `pip install -r requirements.txt`. -2. Go to **core/stt** and run `cargo build --release`. -3. Move the `whisper-rust` executable from target/release to this directory. diff --git a/01OS/01OS/server/stt/whisper-rust/whisper-rust b/01OS/01OS/server/stt/whisper-rust/whisper-rust deleted file mode 100755 index 14a9042..0000000 Binary files a/01OS/01OS/server/stt/whisper-rust/whisper-rust and /dev/null differ diff --git a/01OS/start.sh b/01OS/start.sh index 9409853..0918533 100755 --- a/01OS/start.sh +++ b/01OS/start.sh @@ -71,12 +71,33 @@ if [[ "$ALL_LOCAL" == "True" ]]; then ## WHISPER - WHISPER_PATH="$SCRIPT_DIR/01OS/server/stt/local_service" - if [[ ! -f "${WHISPER_PATH}/${WHISPER_MODEL_NAME}" ]]; then - mkdir -p "${WHISPER_PATH}" - curl -L "${WHISPER_MODEL_URL}${WHISPER_MODEL_NAME}" -o "${WHISPER_PATH}/${WHISPER_MODEL_NAME}" + CWD=$(pwd) + + STT_PATH="$SCRIPT_DIR/01OS/server/stt" + WHISPER_RUST_PATH="${STT_PATH}/whisper-rust" + cd ${WHISPER_RUST_PATH} + + # Check if whisper-rust executable exists + if [[ ! -f "${WHISPER_RUST_PATH}/target/release/whisper-rust" ]]; then + + # Check if Rust is installed. Needed to build whisper executable + if ! command -v rustc &> /dev/null; then + echo "Rust is not installed or is not in system PATH. Please install Rust before proceeding." + exit 1 + fi + + # Build the Whisper Rust executable + cargo build --release + fi + + WHISPER_MODEL_PATH="${STT_PATH}/local_service" + if [[ ! -f "${WHISPER_MODEL_PATH}/${WHISPER_MODEL_NAME}" ]]; then + mkdir -p "${WHISPER_MODEL_PATH}" + curl -L "${WHISPER_MODEL_URL}${WHISPER_MODEL_NAME}" -o "${WHISPER_MODEL_PATH}/${WHISPER_MODEL_NAME}" fi + cd $CWD + ## PIPER PIPER_FOLDER_PATH="$SCRIPT_DIR/01OS/server/tts/local_service" diff --git a/README.md b/README.md index e27e5a5..d859ea7 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ brew install portaudio ffmpeg sudo apt-get install portaudio19-dev ffmpeg ``` +If you want to run local speech-to-text using Whisper, install Rust. Follow the instructions given [here](https://www.rust-lang.org/tools/install). + ## Setup for usage (experimental): ```bash