ggerganov / whisper.spm

whisper.cpp package for the Swift Package Manager
MIT License
168 stars 27 forks source link

SPM: adding package to another package #3

Open triple7 opened 1 year ago

triple7 commented 1 year ago

Hey, first off great repo man. Was about to write a swift wrapper then I saw your spam :)

Just having an issue with below message: product 'whisper.spm' required by package 'swiftwhisper' target 'SwiftWhisperTests' not found in package 'whisper.spm'.

The line where it's hanging is: .testTarget( name: "SwiftWhisperTests", dependencies: ["SwiftWhisper", .product(name: "whisper.spm", package: "whisper.spm")]), ]

I tried whisper.cpp as package or product but that doesn't work. Is there another name to be included? as the normal target dependency works.

finnvoor commented 1 year ago

Replacing dependencies with [.product(name: "whisper", package: "whisper.spm")] should fix it. You can then import whisper to use.

triple7 commented 1 year ago

Thanks for this. it now imports whisper.spm.

I have a follow-up. I’ve followed the swift example, and made a few changes to the WhisperState, mainly to do asynchronous AVAudioInputNode tapping and transcribing.

I get the following: Cannot find type 'WhisperContext' in scope

I’ve imported Whisper and checked what types it has, but no WhisperContext.

Should I just clone the example and extend it, then make a pull request? I think having streaming input capture and transcribing would be useful.

Thanks

On 27 Jan 2023, at 2:56 am, Finn Voorhees @.***> wrote:

Replacing dependencies with [.product(name: "whisper", package: "whisper.spm")] should fix it. You can then import whisper to use.

— Reply to this email directly, view it on GitHub https://github.com/ggerganov/whisper.spm/issues/3#issuecomment-1405307261, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJHQFI7DMJ4FKXXDUJB52TWUKUCVANCNFSM6AAAAAAUHJZKJE. You are receiving this because you authored the thread.

finnvoor commented 1 year ago

This package is just a wrapper around the whisper.cpp files/headers. It seems like you are following the whisper.cpp whisper.swiftui.demo app, which defines WhisperContext here. You should be able to get it working by just copying over that file.

triple7 commented 1 year ago

Ok thanks for the clarification. I was looking to include it in another package to extend the whisper.spm package but this won’t be possible as swift packages aren’t compatible with mix languages.

I’ll find a different way of extending the WhisperState to have the AVAudioInputNode tapping, even if it means importing a project into a project. Will just have to wait for multi language support in SPM.

On 27 Jan 2023, at 9:15 pm, Finn Voorhees @.***> wrote:

This package is just a wrapper around the whisper.cpp files/headers. It seems like you are following the whisper.cpp whisper.swiftui.demo app, which defines WhisperContext here https://github.com/ggerganov/whisper.cpp/blob/master/examples/whisper.swiftui/whisper.cpp.swift/LibWhisper.swift. You should be able to get it working by just copying over that file.

— Reply to this email directly, view it on GitHub https://github.com/ggerganov/whisper.spm/issues/3#issuecomment-1406357279, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJHQFJF2BZBHZIFT63QRRDWUOU47ANCNFSM6AAAAAAUHJZKJE. You are receiving this because you authored the thread.

chidiwilliams commented 1 year ago

@triple7, @Finnvoor, did either of you run into a similar issue importing this project to Xcode? https://github.com/ggerganov/whisper.spm/issues/4

triple7 commented 1 year ago

Sorry for the long delay in replying, I have been overloaded at work, and just getting back.

I think I might fork the project, add the streaming audio capture feature and do a pull request.

On 29 Jan 2023, at 9:52 pm, Chidi Williams @.***> wrote:

@triple7 https://github.com/triple7, @Finnvoor https://github.com/Finnvoor, did either of you run into a similar issue importing this project to Xcode? #4 https://github.com/ggerganov/whisper.spm/issues/4 — Reply to this email directly, view it on GitHub https://github.com/ggerganov/whisper.spm/issues/3#issuecomment-1407641376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJHQFPAAQ4G7FCCXIOTTZLWUZKXHANCNFSM6AAAAAAUHJZKJE. You are receiving this because you were mentioned.