Ahsen Khaliq commited on
Commit
cc8179b
1 Parent(s): 2675f3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -32,7 +32,8 @@ def text_normalizer(text):
32
  return text.translate(str.maketrans('', '', string.punctuation))
33
 
34
  def inference(audio):
35
- speech, rate = soundfile.read(audio.name)
 
36
  nbests = speech2text(speech)
37
  text, *_ = nbests[0]
38
  return f"ASR hypothesis: {text_normalizer(text)}"
 
32
  return text.translate(str.maketrans('', '', string.punctuation))
33
 
34
  def inference(audio):
35
+ speech, rate = librosa.load(audio, sr=16000)
36
+ assert rate == fs, "mismatch in sampling rate"
37
  nbests = speech2text(speech)
38
  text, *_ = nbests[0]
39
  return f"ASR hypothesis: {text_normalizer(text)}"