I am fixed it using the code
public func ensureModel(transcriber: SpeechTranscriber, locale: Locale) async throws {
guard await supported(locale: locale) else {
throw TranscriptionError.internalFailure("localeNotSupported")
}
try await downloadIfNeeded(for: transcriber)
// if await installed(locale: locale) {
// return
// } else {
// try await downloadIfNeeded(for: transcriber)
// }
}
func downloadIfNeeded(for module: SpeechTranscriber) async throws {
if let downloader = try await AssetInventory.assetInstallationRequest(supporting: [module]) {
Log.transcription.info("SpeechTranscriber download \(downloader.progress)")
// self.downloadProgress = downloader.progress
try await downloader.downloadAndInstall()
}
}
Topic:
Media Technologies
SubTopic:
Audio
Tags: