from sys import argv, exit if len(argv) != 2: exit(1) from model import * from preprocessing import * from cc import decode_batch_predictions import numpy as np from spellchecker import SpellChecker sc = SpellChecker() m = model(input_dim = fft_length // 2 + 1, output_dim = char_to_num.vocabulary_size()) m.load_weights('model41-best.keras') sg, _ = encode_single_sample_selectable_dir(argv[1], "") seq = m.predict(np.array([sg])) dc = decode_batch_predictions(seq)[0] print(f"Decode : {dc}") cdc = ' '.join([sc.correction(i) if sc.correction(i) else i for i in dc.split()]) print(f"Correct: {cdc}")