Cheetah Speech-to-Text
React Quick Start
Platforms
- Chrome & Chromium-based browsers
- Edge
- Firefox
- Safari
Requirements
- Picovoice Account and AccessKey
- Node.js 16+
- React 17.0+
- npm
Picovoice Account & AccessKey
Signup or Login to Picovoice Console to get your AccessKey
.
Make sure to keep your AccessKey
secret.
Quick Start
Setup
Install Node.js.
Install the npm packages:
Usage
To initialize Cheetah
, you'll need a Cheetah model file (.pv
). Place the model file in the project's public directory or generate a base64 representation of the file using the built-in script:
Create a cheetahModel
object with either of the methods above:
Import and call the useCheetah
Hook, and initialize Cheetah
with your AccessKey
and cheetahModel
:
Cheetah React binding uses WebVoiceProcessor to record audio. To start recording and processing audio, call start
:
Call stop
to stop recording and processing audio:
Allocated resources are automatically freed on unmount, but can also be done explicitly:
Custom Models
Create custom models using the Picovoice Console.
Train and download a Cheetah speech-to-text model (.pv
) for the target platform Web (WASM)
.
This model file can be used directly with publicPath
, but, if base64
is preferable, convert the .pv
file to a base64
JavaScript variable using the built-in pvbase64
script:
Model files (.pv
) are saved in IndexedDB to be used by Web Assembly.
Either base64
or publicPath
must be set to instantiate Cheetah.
If both are set, Cheetah will use the base64
model.
Demo
For the Cheetah React SDK, there is a React demo project available on the Cheetah GitHub repository.
Setup
Clone the Cheetah repository from GitHub:
Usage
- Install dependencies:
- Run the demo with the
start
script:
Open http://localhost:3000 to view it in the browser.
Enter your access key and press on
Init Cheetah
to start recording for keyword detections.