fix: re-add whisper-rust source code, modify scripts

pull/36/head
Shiven Mian 11 months ago
parent a2b56be005
commit 4e3c1f77a6

@ -5,6 +5,7 @@
# else we use whisper.cpp and piper local models
ALL_LOCAL=False
WHISPER_MODEL_NAME="ggml-tiny.en.bin"
WHISPER_MODEL_URL="https://huggingface.co/ggerganov/whisper.cpp/resolve/main/"
# Uncomment to set your OpenAI API key
# OPENAI_API_KEY=sk-...

Binary file not shown.

@ -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(local_path, 'whisper-rust')
whisper_rust_path = os.path.join(os.path.dirname(__file__), 'whisper-rust')
model_name = os.getenv('WHISPER_MODEL_NAME')
if not model_name:
raise EnvironmentError("WHISPER_MODEL_NAME environment variable is not set.")

@ -54,6 +54,16 @@ if [[ "$@" == *"--expose"* ]]; then
export SERVER_EXPOSE_PUBLICALLY="True"
fi
# Check if "--clear-local" is passed as an argument
if [[ "$@" == *"--clear-local"* ]]; then
# If "--clear-local" is passed, clear the contents of the folders in script_dir/01OS/server/{tts and stt}/local_service
echo "Clearing local services..."
rm -rf "$SCRIPT_DIR/01OS/server/tts/local_service"/*
rm -rf "$SCRIPT_DIR/01OS/server/stt/local_service"/*
echo "Exiting after clearing local services..."
exit 0
fi
### SETUP
if [[ "$ALL_LOCAL" == "True" ]]; then
@ -61,7 +71,6 @@ if [[ "$ALL_LOCAL" == "True" ]]; then
## WHISPER
WHISPER_MODEL_URL="https://huggingface.co/ggerganov/whisper.cpp/resolve/main/"
WHISPER_PATH="$SCRIPT_DIR/01OS/server/stt/local_service"
if [[ ! -f "${WHISPER_PATH}/${WHISPER_MODEL_NAME}" ]]; then
mkdir -p "${WHISPER_PATH}"
@ -70,10 +79,10 @@ if [[ "$ALL_LOCAL" == "True" ]]; then
## PIPER
PIPER_FILE_PATH="$SCRIPT_DIR/01OS/server/tts/local_service${PIPER_URL}${PIPER_ASSETNAME}"
if [[ ! -f "$PIPER_FILE_PATH" ]]; then
PIPER_FOLDER_PATH="$SCRIPT_DIR/01OS/server/tts/local_service"
if [[ ! -f "$PIPER_FOLDER_PATH" ]]; then
mkdir -p "${PIPER_FILE_PATH}"
mkdir -p "${PIPER_FOLDER_PATH}"
OS=$(uname -s)
ARCH=$(uname -m)
@ -94,7 +103,7 @@ if [[ "$ALL_LOCAL" == "True" ]]; then
CWD=$(pwd)
# Navigate to SCRIPT_DIR/01OS/server/tts/local_service
cd $SCRIPT_DIR/01OS/server/tts/local_service
cd ${PIPER_FOLDER_PATH}
curl -L "${PIPER_URL}${PIPER_ASSETNAME}" -o "${PIPER_ASSETNAME}"
tar -xvzf $PIPER_ASSETNAME

Loading…
Cancel
Save