<jupyter_start><jupyter_text>Using predict function Predict function is a generic function that will handle all type of input. It is a high layer api for transcription, if want to do more flexible transcription can use SK class  Predict single or multiple file<jupyter_code>fn = "/content/test/youtube/0228444ff34081eda587c0ca53712486.wav" # or ["/content/audio1.wav","/content/audio2.wav"]
out = predict(fn)
Path(fn).with_suffix(".txt").read_text()
out<jupyter_output><empty_output><jupyter_text>Predict from single or multiple folder<jupyter_code>fn = "/content/test/" # or ["/content/test","/content/data"]
out = predict(fn)
out.keys()
preds = out["texts"]
files = out["filenames"]
data = []
for i,j in zip(preds,files):
    label = j.with_suffix('.txt').read_text()
    data.append([j,label,i,jiwer.compute_measures(label,i)['wer'],jiwer.compute_measures([l for l in label],[ii for ii in i])['wer']])
df = pd.DataFrame(data)
df.columns = ["path","label","pred","wer","cer"]
df.head()
df["wer"].mean(),df["cer"].mean()<jupyter_output><empty_output><jupyter_text>Using SK class Why use SK class? if want to transcribe multiple time predict will load the model and lm multiple time which is not efficient, with SK object you can call it multiple time without reloading anything again.<jupyter_code>from sk import SK
asr = SK(model="conformer_small",decoder=None)
asr.transcribe_file(fn="/content/test/youtube/0228444ff34081eda587c0ca53712486.wav")
import librosa
asr.transcribe_array(array=librosa.load("/content/test/youtube/0228444ff34081eda587c0ca53712486.wav",16000)[0])
asr = SK(model="silero_en",decoder=None)
asr.transcribe_file(fn="/content/testset-imda/0.wav")
asr = SK(model="silero_en",decoder="en")
asr.transcribe_file(fn="/content/testset-imda/0.wav")<jupyter_output>Total input path: 1
Total audio found(.wav): 1
{'fraction_non_alphanumeric': 0.14614121510673234, 'fraction_numerical': 0.04597701149425287, 'mean_word_length': 6.947826086956522, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '509995', 'license': 'MIT', 'n_tokens_mistral': 695, 'n_tokens_neox': 631, 'n_words': 144, 'path': 'tutorials/1.speech_to_text.ipynb', 'repo_name': 'redapesolutions/suara-kami-community', 'size': '1827'}