Merge branch 'main' into feature/dotenv

# Conflicts:
#	OS/01/start.sh
pull/20/head
Tom Chapin 1 year ago
commit a6fbe102e3

@ -189,8 +189,8 @@ async def websocket_communication(WS_URL):
except Exception as e:
logging.exception(f"An error occurred during websocket communication. {e}")
logging.info(f"Connecting to `{WS_URL}`...")
logger.warn(f"An error occurred during websocket communication. {e}")
logger.info(f"Connecting to `{WS_URL}`...")
await asyncio.sleep(2)

@ -3,12 +3,16 @@ if [ ! -f ".env" ]; then
echo "Error: .env file does not exist. To create one, see .env.example for an example."
exit 1
fi
set -a; source .env; set +a
set -a; source .env; set +az
### 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)

@ -56,13 +56,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
])

@ -27,8 +27,6 @@ python -m pip install -r requirements.txt
```
NB: Depending on your local Python version, you may run into [this issue↗](https://github.com/TaylorSMarks/playsound/issues/150) installing playsound. Workarounds are provided in the issue.
If you want to run local speech-to-text from whisper, download the GGML Whisper model from [Huggingface](https://huggingface.co/ggerganov/whisper.cpp). Then in `OS/01/start.sh`, set `ALL_LOCAL=TRUE` and set `WHISPER_MODEL_PATH` to the path of the model.
## Usage
```bash
@ -36,6 +34,7 @@ cd OS/01
bash start.sh
```
If you want to run local text-to-speech and speech-to-text, set `ALL_LOCAL` in your `OS/01/.env` config to True. This will use the [whisper.cpp](https://github.com/ggerganov/whisper.cpp) and [Piper](https://github.com/rhasspy/piper) models.
<br>
## Background

Loading…
Cancel
Save