Update doc for TypeScript support
This commit is contained in:
parent
3581bdf9fe
commit
5723dba180
@ -1,6 +1,8 @@
|
||||
JavaScript (NodeJS / ElectronJS)
|
||||
================================
|
||||
|
||||
Support for TypeScript is :download:`provided in index.d.ts<../native_client/javascript/index.d.ts>`
|
||||
|
||||
Model
|
||||
-----
|
||||
|
||||
|
@ -4,20 +4,20 @@ JavaScript API Usage example
|
||||
Creating a model instance and loading model
|
||||
-------------------------------------------
|
||||
|
||||
.. literalinclude:: ../native_client/javascript/client.js
|
||||
.. literalinclude:: ../native_client/javascript/client.ts
|
||||
:language: javascript
|
||||
:linenos:
|
||||
:lines: 56,69
|
||||
:lines: 49,54
|
||||
|
||||
Performing inference
|
||||
--------------------
|
||||
|
||||
.. literalinclude:: ../native_client/javascript/client.js
|
||||
.. literalinclude:: ../native_client/javascript/client.ts
|
||||
:language: javascript
|
||||
:linenos:
|
||||
:lines: 122
|
||||
:lines: 114,118
|
||||
|
||||
Full source code
|
||||
----------------
|
||||
|
||||
See :download:`Full source code<../native_client/javascript/client.js>`.
|
||||
See :download:`Full source code<../native_client/javascript/client.ts>`.
|
||||
|
@ -125,6 +125,8 @@ Please note that as of now, we support:
|
||||
- Node.JS versions 4 to 13.
|
||||
- Electron.JS versions 1.6 to 7.1
|
||||
|
||||
TypeScript support is also provided.
|
||||
|
||||
Alternatively, if you're using Linux and have a supported NVIDIA GPU, you can install the GPU specific package as follows:
|
||||
|
||||
.. code-block:: bash
|
||||
@ -133,7 +135,7 @@ Alternatively, if you're using Linux and have a supported NVIDIA GPU, you can in
|
||||
|
||||
See the `release notes <https://github.com/mozilla/DeepSpeech/releases>`_ to find which GPUs are supported. Please ensure you have the required `CUDA dependency <#cuda-dependency>`_.
|
||||
|
||||
See :github:`client.js <native_client/javascript/client.js>` for an example of how to use the bindings.
|
||||
See :github:`client.ts <native_client/javascript/client.ts>` for an example of how to use the bindings.
|
||||
|
||||
Using the Command-Line client
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -5,7 +5,8 @@ Full project description and documentation on GitHub: [https://github.com/mozill
|
||||
You can generate the TypeScript type declaration file using `dts-gen`.
|
||||
This requires a compiled/installed version of the DeepSpeech NodeJS client.
|
||||
|
||||
To generate a new `index.d.ts` type declaration file, run:
|
||||
Upon API change, it is required to generate a new `index.d.ts` type declaration
|
||||
file, you have to run:
|
||||
|
||||
```sh
|
||||
npm install -g dts-gen
|
||||
@ -14,16 +15,4 @@ dts-gen --module deepspeech --file index.d.ts
|
||||
|
||||
### Example usage
|
||||
|
||||
```javascript
|
||||
/// index.ts
|
||||
import DeepSpeech from "deepspeech";
|
||||
|
||||
let modelPath = '/path/to/model';
|
||||
let model = new DeepSpeech.Model(modelPath);
|
||||
model.setBeamWidth(1000);
|
||||
|
||||
let audioBuffer = ...;
|
||||
model.sttWithMetadata(audioBuffer);
|
||||
|
||||
FreeModel(model);
|
||||
```
|
||||
See `client.ts`
|
||||
|
Loading…
Reference in New Issue
Block a user