react-native-whisper v0.0.1
react-native-whisper
This is a proof of concept of a JSI library for OpenAI Whisper , it combines a C++ port of Whisper from whisper.cpp and a JSI template from this blog.
Usage
import Whisper from 'react-native-whisper'
Whisper.transcribeWavToText(pathOfModel,pathOfAudio,(text)=>{alert(text)})You can specify the location of the model or .wav audio file by providing either its full path (e.g., file:///path/to/file) or its Unix-style path (e.g., /path/to/file).
This project is in no way stable or complete!! Feel free to contribute.
Installation
npm install react-native-whisperyarn add react-native-whisperFor iOS also run pod install in /ios folder.
If you are using with Expo, run
expo prebuildPrerequisites
You must have Android NDK and CMake installed on android to build the library.
Methods
The following methods are implemented.
Platfom agnostic
The relevant code is present in cpp/example.cpp file.
helloWorld():string;
multiplyWithCallback(x:number,y:number,callback:(z:number) => void):void
multiply(x:number,y:number):numberPlatform specific
The relevant code on android is in android/cpp-adapter.cpp and ios/SimpleJsi.mm on iOS.
getDeviceName():string
setItem(key:string,value:string):boolean
getItem(key:string):stringBasic usage example
import simpleJsiModule from "react-native-jsi-template";
simpleJsiModule.helloWorld() // returns helloworld.Run the example app for more.
Thanks to these libraries & their authors:
The initial work done by authors of the following libraries has helped a lot in writing the blog and keeping this repo updated.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
3 years ago