Kh0128/Aphasia_Classification__Lang
0
1import json2from utils_audio import convert_to_wav3from to_cha import to_cha_from_wav4from cha_json import cha_to_json_file5from output import predict_from_chajson6 7MODEL_DIR = "./adaptive_aphasia_model"8 9def run_pipeline(in_media_path: str, out_style: str = "json") -> str:10 wav = convert_to_wav(in_media_path, sr=16000, mono=True)11 cha = to_cha_from_wav(wav, lang="eng")12 chajson_path, _ = cha_to_json_file(cha)13 results = predict_from_chajson(MODEL_DIR, chajson_path, output_file=None)14 return json.dumps(results, ensure_ascii=False, indent=2)15 