fix: re-add whisper-rust source code, modify scripts
This commit is contained in:
parent
a2b56be005
commit
4e3c1f77a6
|
@ -5,6 +5,7 @@
|
||||||
# else we use whisper.cpp and piper local models
|
# else we use whisper.cpp and piper local models
|
||||||
ALL_LOCAL=False
|
ALL_LOCAL=False
|
||||||
WHISPER_MODEL_NAME="ggml-tiny.en.bin"
|
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
|
# Uncomment to set your OpenAI API key
|
||||||
# OPENAI_API_KEY=sk-...
|
# OPENAI_API_KEY=sk-...
|
||||||
|
|
Binary file not shown.
|
@ -57,7 +57,7 @@ def run_command(command):
|
||||||
|
|
||||||
def get_transcription_file(wav_file_path: str):
|
def get_transcription_file(wav_file_path: str):
|
||||||
local_path = os.path.join(os.path.dirname(__file__), 'local_service')
|
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')
|
model_name = os.getenv('WHISPER_MODEL_NAME')
|
||||||
if not model_name:
|
if not model_name:
|
||||||
raise EnvironmentError("WHISPER_MODEL_NAME environment variable is not set.")
|
raise EnvironmentError("WHISPER_MODEL_NAME environment variable is not set.")
|
||||||
|
|
|
@ -54,6 +54,16 @@ if [[ "$@" == *"--expose"* ]]; then
|
||||||
export SERVER_EXPOSE_PUBLICALLY="True"
|
export SERVER_EXPOSE_PUBLICALLY="True"
|
||||||
fi
|
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
|
### SETUP
|
||||||
|
|
||||||
if [[ "$ALL_LOCAL" == "True" ]]; then
|
if [[ "$ALL_LOCAL" == "True" ]]; then
|
||||||
|
@ -61,7 +71,6 @@ if [[ "$ALL_LOCAL" == "True" ]]; then
|
||||||
|
|
||||||
## WHISPER
|
## WHISPER
|
||||||
|
|
||||||
WHISPER_MODEL_URL="https://huggingface.co/ggerganov/whisper.cpp/resolve/main/"
|
|
||||||
WHISPER_PATH="$SCRIPT_DIR/01OS/server/stt/local_service"
|
WHISPER_PATH="$SCRIPT_DIR/01OS/server/stt/local_service"
|
||||||
if [[ ! -f "${WHISPER_PATH}/${WHISPER_MODEL_NAME}" ]]; then
|
if [[ ! -f "${WHISPER_PATH}/${WHISPER_MODEL_NAME}" ]]; then
|
||||||
mkdir -p "${WHISPER_PATH}"
|
mkdir -p "${WHISPER_PATH}"
|
||||||
|
@ -70,10 +79,10 @@ if [[ "$ALL_LOCAL" == "True" ]]; then
|
||||||
|
|
||||||
## PIPER
|
## PIPER
|
||||||
|
|
||||||
PIPER_FILE_PATH="$SCRIPT_DIR/01OS/server/tts/local_service${PIPER_URL}${PIPER_ASSETNAME}"
|
PIPER_FOLDER_PATH="$SCRIPT_DIR/01OS/server/tts/local_service"
|
||||||
if [[ ! -f "$PIPER_FILE_PATH" ]]; then
|
if [[ ! -f "$PIPER_FOLDER_PATH" ]]; then
|
||||||
|
|
||||||
mkdir -p "${PIPER_FILE_PATH}"
|
mkdir -p "${PIPER_FOLDER_PATH}"
|
||||||
|
|
||||||
OS=$(uname -s)
|
OS=$(uname -s)
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
|
@ -94,7 +103,7 @@ if [[ "$ALL_LOCAL" == "True" ]]; then
|
||||||
CWD=$(pwd)
|
CWD=$(pwd)
|
||||||
|
|
||||||
# Navigate to SCRIPT_DIR/01OS/server/tts/local_service
|
# 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}"
|
curl -L "${PIPER_URL}${PIPER_ASSETNAME}" -o "${PIPER_ASSETNAME}"
|
||||||
tar -xvzf $PIPER_ASSETNAME
|
tar -xvzf $PIPER_ASSETNAME
|
||||||
|
|
Loading…
Reference in New Issue