Create README.md

#3
by Xenova HF staff - opened
Files changed (1) hide show
  1. README.md +53 -0
README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ pipeline_tag: text-to-speech
4
+ tags:
5
+ - transformers.js
6
+ - mms
7
+
8
+ ---
9
+
10
+ ## Usage
11
+
12
+ ### Transformers
13
+
14
+ (TODO)
15
+
16
+ ### Transformers.js
17
+
18
+ If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@xenova/transformers) using:
19
+ ```bash
20
+ npm i @xenova/transformers
21
+ ```
22
+
23
+ **Example:** Generate Spanish speech with `ylacombe/mms-spa-finetuned-chilean-monospeaker`.
24
+ ```js
25
+ import { pipeline } from '@xenova/transformers';
26
+
27
+ // Create a text-to-speech pipeline
28
+ const synthesizer = await pipeline('text-to-speech', 'Xenova/mms-tts-spa', {
29
+ quantized: false, // Remove this line to use the quantized version (default)
30
+ });
31
+
32
+ // Generate speech
33
+ const output = await synthesizer('Hola, ¿cómo estás hoy?');
34
+ console.log(output);
35
+ // {
36
+ // audio: Float32Array(69888) [ ... ],
37
+ // sampling_rate: 16000
38
+ // }
39
+ ```
40
+
41
+ Optionally, save the audio to a wav file (Node.js):
42
+ ```js
43
+ import wavefile from 'wavefile';
44
+ import fs from 'fs';
45
+
46
+ const wav = new wavefile.WaveFile();
47
+ wav.fromScratch(1, output.sampling_rate, '32f', output.audio);
48
+ fs.writeFileSync('out.wav', wav.toBuffer());
49
+ ```
50
+
51
+
52
+ <audio controls src="https://cdn-uploads.huggingface.co/production/uploads/61b253b7ac5ecaae3d1efe0c/6FvN6zFSHGeenWS2-H8xv.wav"></audio>
53
+