sw005320 commited on
Commit
4970e8f
·
verified ·
1 Parent(s): 69415c4

Add a usage example to the model card

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