Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cf311a
commit cf54e4e
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
class WhisperkitCli < Formula | ||
desc "Swift native on-device speech recognition with Whisper for Apple Silicon" | ||
homepage "https://github.com/argmaxinc/WhisperKit" | ||
url "https://github.com/argmaxinc/WhisperKit.git", | ||
tag: "v0.4.0", | ||
revision: "59cb8516c708e3e2f18198002600026b5a1135ca" | ||
license "MIT" | ||
|
||
depends_on xcode: ["15.0", :build] | ||
depends_on arch: :arm64 | ||
depends_on :macos | ||
depends_on macos: :ventura | ||
uses_from_macos "swift" | ||
|
||
def install | ||
system "swift", "build", "-c", "release", "--product", "whisperkit-cli", "--disable-sandbox" | ||
bin.install ".build/release/whisperkit-cli" | ||
end | ||
|
||
test do | ||
mkdir_p "#{testpath}/tokenizer" | ||
mkdir_p "#{testpath}/model" | ||
whisperkit_command = [ | ||
"#{bin}/whisperkit-cli", | ||
"transcribe", | ||
"--model", | ||
"tiny", | ||
"--download-model-path", | ||
"#{testpath}/model", | ||
"--download-tokenizer-path", | ||
"#{testpath}/tokenizer", | ||
"--audio-path", | ||
test_fixtures("test.mp3"), | ||
"--verbose", | ||
].join(" ") | ||
assert_includes shell_output(whisperkit_command), "Transcription:" | ||
end | ||
end |