Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup instructions #23

Open
jeffysmak opened this issue Oct 10, 2023 · 2 comments
Open

setup instructions #23

jeffysmak opened this issue Oct 10, 2023 · 2 comments

Comments

@jeffysmak
Copy link

Hi, thanks for the great plugin, but unfortunately i cannot able to run it.

Whisper whisper = Whisper(whisperLib: "libwhisper.so");
Version v = await w.getVersion();
print(v?.rawData);

i want to know is there any other setup or configuration needs to be done before calling whisper. i am getting error in above code

Invalid argument(s): Failed to load dynamic library 'libwhisper.so': dlopen failed: library "libwhisper.so" not found

also i am confused at libwhisper.so file where to place or it will created automatically ?

@zackattack73
Copy link

Hello,
I put the file as an asset file in a folder "assets".
Then I use this function to get the file :

Future<File> _getFileFromAssets(String path) async {
  Directory tempDir = await getTemporaryDirectory();
  String tempPath = tempDir.path;
  var filePath = "$tempPath/$path";
  var file = File(filePath);
  if (file.existsSync()) {
    return file;
  } else {
    final byteData = await rootBundle.load('assets/$path');
    final buffer = byteData.buffer;
    await file.create(recursive: true);
    return file.writeAsBytes(buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
  }
}

Here is how I init Whisper :

  initWhisper() async {
    String pathLibrary = (await _getFileFromAssets("libwhisper_android.so")).path;
    whisper = Whisper(whisperLib: pathLibrary);
  }

@jeffysmak
Copy link
Author

thanks for your help, can you please tell how do you create libwhisper.so ?
i tried with make libwhisper.so as instructed here but not work, my system is Mac m1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants