chenjoachim's picture
Upload 7 files
f450982
raw
history blame
646 Bytes
from typing import List
import argparse
import torch
from speechbrain.pretrained import EncoderDecoderASR
def asr_model_inference(asr_model: EncoderDecoderASR, audios: List[str]) -> List[str]:
return [asr_model.transcribe_file(audio) for audio in audios]
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-I", dest="audio_file", required=True)
args = parser.parse_args()
asr_model = EncoderDecoderASR.from_hparams(
source="./infernce", hparams_file="hyperparams.yaml", savedir="inference", run_opts={"device": "cpu"})
print(asr_model_inference(asr_model, [args.audio_file]))