Automatic Speech Recognition
ESPnet
English
audio
sw005320 commited on
Commit
fc4a6ac
·
verified ·
1 Parent(s): 2ce2665

Add a usage example to the model card

Browse files
Files changed (1) hide show
  1. README.md +15 -0
README.md CHANGED
@@ -9,6 +9,21 @@ datasets:
9
  license: cc-by-4.0
10
  ---
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  ## ESPnet2 ASR model
13
 
14
  ### `espnet/cmusic_dev`
 
9
  license: cc-by-4.0
10
  ---
11
 
12
+ ## Usage
13
+
14
+ ```python
15
+ import librosa
16
+ from espnet2.bin.asr_inference import Speech2Text
17
+
18
+ speech2text = Speech2Text.from_pretrained(model_tag="espnet/cmusic_dev")
19
+ # librosa resamples and mixes to one channel, so any file works; 16000 is
20
+ # what nearly every espnet recogniser is trained on - check this model's
21
+ # config if its audio is not 16 kHz
22
+ speech, rate = librosa.load("audio.wav", sr=16000, mono=True)
23
+ text, *_ = speech2text(speech)[0]
24
+ print(text)
25
+ ```
26
+
27
  ## ESPnet2 ASR model
28
 
29
  ### `espnet/cmusic_dev`