File size: 859 Bytes
0479abb e39554c 0479abb e39554c 0479abb e39554c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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:
# Restore the ASR model from the provided path
model = nemo_asr.models.ASRModel.restore_from(restore_path=model_path)
# Transcribe the given audio file
text = model.transcribe([audio_file_path])
print({"result": text[0]})
if __name__ == "__main__":
# Parse command line arguments
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,
) |