Skip to content

Commit a192004

Browse files
authored
Merge pull request #25 from exPHAT/enhanced_platform_support
2 parents 54322da + 21a2720 commit a192004

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

Sources/SwiftWhisper/Whisper.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public class Whisper {
175175
cancelCallback = completionHandler
176176
}
177177

178-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
178+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
179179
public func transcribe(audioFrames: [Float]) async throws -> [Segment] {
180180
return try await withCheckedThrowingContinuation { cont in
181181
self.transcribe(audioFrames: audioFrames) { result in
@@ -189,7 +189,7 @@ public class Whisper {
189189
}
190190
}
191191

192-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
192+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
193193
public func cancel() async throws {
194194
return try await withCheckedThrowingContinuation { cont in
195195
do {

Tests/WhisperTests/File Tests/ModelFileTestCase.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import FoundationNetworking
66
#endif
77

88
protocol ModelFileTestCase: ResourceDependentTestCase {
9-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
9+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
1010
var tinyModelURL: URL? { get async }
1111
}
1212

1313
extension ModelFileTestCase {
14-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
14+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
1515
var tinyModelURL: URL? {
1616
get async {
1717
let hostedModelURL = URL(string: "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin")!

Tests/WhisperTests/Model Tests/LoadModelTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import XCTest
33
@testable import SwiftWhisper
44

55
class LoadModelTests: ResourceDependentTestCase, ModelFileTestCase {
6-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
6+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
77
func testLoadModelFromFile() async {
88
let modelURL = await tinyModelURL!
99
let _ = Whisper(fromFileURL: modelURL)
1010
}
1111

12-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
12+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
1313
func testLoadModelFromData() async throws {
1414
let modelURL = await tinyModelURL!
1515
let modelData = try Data(contentsOf: modelURL)

Tests/WhisperTests/Transcription Tests/TranscriptionCancellationTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import XCTest
55
class TranscriptionCancellationTests: ResourceDependentTestCase, ModelFileTestCase, AudioFileTestCase {
66
let timeout: TimeInterval = 60
77

8-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
8+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
99
fileprivate var whisperTinyModel: Whisper {
1010
get async {
1111
let modelURL = await tinyModelURL!
@@ -15,7 +15,7 @@ class TranscriptionCancellationTests: ResourceDependentTestCase, ModelFileTestCa
1515
}
1616
}
1717

18-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
18+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
1919
func testTranscribeCancellation() async {
2020
let whisper = await whisperTinyModel
2121
let jfk = jfkAudioFrames!
@@ -42,7 +42,7 @@ class TranscriptionCancellationTests: ResourceDependentTestCase, ModelFileTestCa
4242
wait(for: [cancelExpectation, failureExpectation], timeout: timeout)
4343
}
4444

45-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
45+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
4646
func testTranscribeCancellationRestart() async {
4747
let whisper = await whisperTinyModel
4848
let jfk = jfkAudioFrames!
@@ -80,7 +80,7 @@ class TranscriptionCancellationTests: ResourceDependentTestCase, ModelFileTestCa
8080
wait(for: [cancelExpectation, failureExpectation, restartExpectation], timeout: timeout)
8181
}
8282

83-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
83+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
8484
func testTranscribeDoubleCancellation() async {
8585
let whisper = await whisperTinyModel
8686
let jfk = jfkAudioFrames!
@@ -113,7 +113,7 @@ class TranscriptionCancellationTests: ResourceDependentTestCase, ModelFileTestCa
113113
wait(for: [cancelExpectation, failureExpectation], timeout: timeout)
114114
}
115115

116-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
116+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
117117
func testTranscribePrematureCancellation() async {
118118
let whisper = await whisperTinyModel
119119

@@ -128,7 +128,7 @@ class TranscriptionCancellationTests: ResourceDependentTestCase, ModelFileTestCa
128128
}
129129
}
130130

131-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
131+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
132132
func testTranscriptionAsyncCancel() async {
133133
let whisper = await whisperTinyModel
134134
let jfk = jfkAudioFrames!
@@ -159,7 +159,7 @@ class TranscriptionCancellationTests: ResourceDependentTestCase, ModelFileTestCa
159159
}
160160

161161

162-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
162+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
163163
func testTranscriptionAsyncCancelTwice() async {
164164
let whisper = await whisperTinyModel
165165
let jfk = jfkAudioFrames!

Tests/WhisperTests/Transcription Tests/TranscriptionParameterTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import XCTest
44
class TranscriptionParamterTests: ResourceDependentTestCase, ModelFileTestCase, AudioFileTestCase {
55
let timeout: TimeInterval = 60
66

7-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
7+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
88
func testParametersMaxLen() async throws {
99
let params = WhisperParams()
1010
params.language = .english

Tests/WhisperTests/Transcription Tests/TranscriptionTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import XCTest
44
class TranscriptionTests: ResourceDependentTestCase, ModelFileTestCase, AudioFileTestCase {
55
let timeout: TimeInterval = 60
66

7-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
7+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
88
fileprivate var whisperTinyModel: Whisper {
99
get async {
1010
let modelURL = await tinyModelURL!
@@ -14,7 +14,7 @@ class TranscriptionTests: ResourceDependentTestCase, ModelFileTestCase, AudioFil
1414
}
1515
}
1616

17-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
17+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
1818
func testTrascribeCompletionHandler() async {
1919
let whisper = await whisperTinyModel
2020
let jfk = jfkAudioFrames!
@@ -34,7 +34,7 @@ class TranscriptionTests: ResourceDependentTestCase, ModelFileTestCase, AudioFil
3434
wait(for: [successExpectation], timeout: timeout)
3535
}
3636

37-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
37+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
3838
func testTranscribeExclusivity() async {
3939
let whisper = await whisperTinyModel
4040
let jfk = jfkAudioFrames!
@@ -65,7 +65,7 @@ class TranscriptionTests: ResourceDependentTestCase, ModelFileTestCase, AudioFil
6565
wait(for: [successExpectation, failureExpectation], timeout: timeout)
6666
}
6767

68-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
68+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
6969
func testTranscribeInvalidFramesError() async {
7070
let whisper = await whisperTinyModel
7171

@@ -91,7 +91,7 @@ class TranscriptionTests: ResourceDependentTestCase, ModelFileTestCase, AudioFil
9191
}
9292

9393
extension TranscriptionTests: WhisperDelegate {
94-
@available(iOS 13, macOS 10.15, watchOS 6.0, *)
94+
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
9595
func testTranscribeDelegate() async throws {
9696
let whisper = await whisperTinyModel
9797
let jfk = jfkAudioFrames!

0 commit comments

Comments
 (0)