sw005320 commited on
Commit
13c805b
·
verified ·
1 Parent(s): 169f142

Add a usage example to the model card

Browse files
Files changed (1) hide show
  1. README.md +15 -0
README.md CHANGED
@@ -12,6 +12,21 @@ language:
12
  pipeline_tag: automatic-speech-recognition
13
  ---
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  ## UniverSLU-17 Task Specifier
16
 
17
  UniverSLU-17 Task Specifier is a Multi-task Spoken Language Understanding model from CMU WAVLab.
 
12
  pipeline_tag: automatic-speech-recognition
13
  ---
14
 
15
+ ## Usage
16
+
17
+ ```python
18
+ import librosa
19
+ from espnet2.bin.asr_inference import Speech2Text
20
+
21
+ speech2text = Speech2Text.from_pretrained(model_tag="espnet/UniverSLU-17-Task-Specifier")
22
+ # librosa resamples and mixes to one channel, so any file works; 16000 is
23
+ # what nearly every espnet recogniser is trained on - check this model's
24
+ # config if its audio is not 16 kHz
25
+ speech, rate = librosa.load("audio.wav", sr=16000, mono=True)
26
+ text, *_ = speech2text(speech)[0]
27
+ print(text)
28
+ ```
29
+
30
  ## UniverSLU-17 Task Specifier
31
 
32
  UniverSLU-17 Task Specifier is a Multi-task Spoken Language Understanding model from CMU WAVLab.