Skip to content

Commit

Permalink
Update download logic for example app
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachNagengast committed Feb 28, 2024
1 parent da88f72 commit 2846fd9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Examples/WhisperAX/WhisperAX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 0.1.1;
PRODUCT_BUNDLE_IDENTIFIER = com.argmax.whisperkit.WhisperAX;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down Expand Up @@ -909,7 +909,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 0.1.1;
PRODUCT_BUNDLE_IDENTIFIER = com.argmax.whisperkit.WhisperAX;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/huggingface/swift-transformers.git",
"state" : {
"revision" : "564442fba36b0b694d730a62d0593e5f54043b55"
"revision" : "564442fba36b0b694d730a62d0593e5f54043b55",
"version" : "0.1.2"
}
}
],
Expand Down
10 changes: 6 additions & 4 deletions Examples/WhisperAX/WhisperAX/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ struct ContentView: View {
})
}
.onAppear {
Task {
whisperKit = try await WhisperKit(verbose: true, logLevel: .debug)
}

#if os(macOS)
selectedCategoryId = menu.first(where: { $0.name == selectedTab })?.id
#endif
Expand Down Expand Up @@ -713,6 +709,12 @@ struct ContentView: View {
}
})
}

await MainActor.run {
loadingProgressValue = specializationProgressRatio
modelState = .downloaded
}


if let modelFolder = folder {
whisperKit.modelFolder = modelFolder
Expand Down
4 changes: 3 additions & 1 deletion Sources/WhisperKit/Core/WhisperKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ public class WhisperKit: Transcriber {
do {
let modelFolder = try await hubApi.snapshot(from: repo, matching: ["*\(variant.description)/*"]) { progress in
Logging.debug(progress)
progressCallback?(progress)
if let callback = progressCallback {
callback(progress)
}
}

let modelFolderName = modelFolder.appending(path: "openai_whisper-\(variant)")
Expand Down

0 comments on commit 2846fd9

Please sign in to comment.