sw005320 commited on
Commit
a6d83cb
·
verified ·
1 Parent(s): ce21bce

Add a usage example to the model card

Browse files
Files changed (1) hide show
  1. README.md +15 -0
README.md CHANGED
@@ -8,6 +8,21 @@ datasets:
8
  - openslr
9
  ---
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ### Demo: How to use in ESPnet2
12
  ```python
13
  # coming soon
 
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/aaf_openslr57")
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
  ### Demo: How to use in ESPnet2
27
  ```python
28
  # coming soon