Первый релиз WhisperKey
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/zsh
|
||||
set -euo pipefail
|
||||
|
||||
SUPPORT_DIR="$HOME/Library/Application Support/WhisperKey"
|
||||
WAV_PATH="${1:-$SUPPORT_DIR/last-dictation.wav}"
|
||||
|
||||
if [[ ! -f "$WAV_PATH" ]]; then
|
||||
echo "Нет записи для сравнения: $WAV_PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== whisper.cpp ==="
|
||||
"$SUPPORT_DIR/whisper-cli" \
|
||||
-m "$SUPPORT_DIR/ggml-large-v3-turbo.bin" \
|
||||
-f "$WAV_PATH" \
|
||||
-l ru \
|
||||
--no-timestamps \
|
||||
--no-prints \
|
||||
--no-fallback \
|
||||
--max-context 0
|
||||
|
||||
echo
|
||||
echo "=== openai/whisper ==="
|
||||
"$SUPPORT_DIR/openai-whisper-venv/bin/python" - "$WAV_PATH" "$SUPPORT_DIR/openai-models" <<'PY'
|
||||
import sys
|
||||
import whisper
|
||||
|
||||
audio_path, model_dir = sys.argv[1], sys.argv[2]
|
||||
model = whisper.load_model("turbo", download_root=model_dir)
|
||||
result = model.transcribe(
|
||||
audio_path,
|
||||
language="ru",
|
||||
temperature=0,
|
||||
condition_on_previous_text=False,
|
||||
fp16=False,
|
||||
)
|
||||
print(result["text"].strip())
|
||||
PY
|
||||
Reference in New Issue
Block a user