|
import argparse |
|
from typing import Dict |
|
|
|
import nemo.collections.asr as nemo_asr |
|
|
|
|
|
def predict_model( |
|
model_path: str = None, |
|
audio_file_path: str = None, |
|
) -> Dict: |
|
|
|
model = nemo_asr.models.ASRModel.restore_from(restore_path=model_path) |
|
|
|
text = model.transcribe([audio_file_path]) |
|
print({"result": text[0]}) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
parser = argparse.ArgumentParser() |
|
parser.add_argument("--model_path", default=None, help="Path to a model to evaluate.") |
|
parser.add_argument("--audio_file_path", default=None, help="Path for train manifest JSON file.") |
|
args = parser.parse_args() |
|
|
|
predict_model( |
|
model_path=args.model_path, |
|
audio_file_path=args.audio_file_path, |
|
) |