voice-command-android/download-models.sh

38 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Download Whisper models for bundling with the Android app
set -e
MODEL_DIR="app/src/main/assets/models"
mkdir -p "$MODEL_DIR"
echo "Downloading Whisper models for sherpa-onnx..."
# Base URL for sherpa-onnx models
BASE_URL="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models"
# Download tiny.en model (smallest, English only, ~40MB total)
echo "Downloading tiny.en model..."
curl -L -o "$MODEL_DIR/tiny.en-encoder.int8.onnx" \
"$BASE_URL/sherpa-onnx-whisper-tiny.en/tiny.en-encoder.int8.onnx"
curl -L -o "$MODEL_DIR/tiny.en-decoder.int8.onnx" \
"$BASE_URL/sherpa-onnx-whisper-tiny.en/tiny.en-decoder.int8.onnx"
curl -L -o "$MODEL_DIR/tokens.txt" \
"$BASE_URL/sherpa-onnx-whisper-tiny.en/tiny.en-tokens.txt"
# Optional: Download base.en model (~75MB total)
# echo "Downloading base.en model..."
# curl -L -o "$MODEL_DIR/base.en-encoder.int8.onnx" \
# "$BASE_URL/sherpa-onnx-whisper-base.en/base.en-encoder.int8.onnx"
# curl -L -o "$MODEL_DIR/base.en-decoder.int8.onnx" \
# "$BASE_URL/sherpa-onnx-whisper-base.en/base.en-decoder.int8.onnx"
echo ""
echo "Models downloaded to $MODEL_DIR/"
ls -lh "$MODEL_DIR/"
echo ""
echo "Next steps:"
echo "1. Build the APK: ./gradlew assembleDebug"
echo "2. Install on device: adb install app/build/outputs/apk/debug/app-debug.apk"