diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..29091cb --- /dev/null +++ b/build.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Build Script for whisper-transcribe +# This script bundles the project into a single executable for Apple Silicon. + +echo "--- Starting Build Process ---" + +# Ensure PyInstaller is installed +if ! command -v pyinstaller &> /dev/null +then + echo "PyInstaller not found. Installing..." + pip install pyinstaller +fi + +# Run PyInstaller +# --onefile: Bundle into a single executable +# --collect-all: Ensure all sub-dependencies of heavy libraries are included +# --hidden-import: Explicitly include libraries that might be missed by static analysis +pyinstaller --onefile + --name whisper-transcribe + --collect-all mlx_whisper + --collect-all transformers + --collect-all silero_vad + --collect-all torch + --hidden-import=sacremoses + --hidden-import=joblib + transcribe.py + +echo "--- Build Complete ---" +echo "Binary location: dist/whisper-transcribe" diff --git a/history.md b/history.md index 3895ff0..623de8b 100644 --- a/history.md +++ b/history.md @@ -59,3 +59,16 @@ The project now features a high-performance, Apple Silicon-optimized pipeline th - Switched to `whisper-small-mlx` (multilingual). - **Hub-and-Spoke Model:** If a non-English language is detected, Whisper's `task="translate"` is used to create an English "bridge" text, which is then fed into the specialized MarianMT models. - **Outcome:** Full support for multilingual input with centralized translation. + +## Phase 8: Compilation to Binary +- **Goal:** Distribute the script as a single, standalone executable for macOS terminal. +- **Tool:** `PyInstaller`. +- **Process:** + - Used `--onefile` to bundle the entire Python runtime and its heavy dependencies (Torch, MLX, Transformers). + - Excluded build artifacts (`build/`, `dist/`, `.spec`) from the repository. +- **Build Script:** + ```bash + chmod +x build.sh + ./build.sh + ``` +- **Outcome:** A standalone `whisper-transcribe` binary in the `dist/` directory.