File size: 562 Bytes
af07bc1 256d133 af07bc1 256d133 af07bc1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import json
from utils_audio import convert_to_wav
from to_cha import to_cha_from_wav
from cha_json import cha_to_json_file
from output import predict_from_chajson
MODEL_DIR = "./adaptive_aphasia_model"
def run_pipeline(in_media_path: str, out_style: str = "json") -> str:
wav = convert_to_wav(in_media_path, sr=16000, mono=True)
cha = to_cha_from_wav(wav, lang="eng")
chajson_path, _ = cha_to_json_file(cha)
results = predict_from_chajson(MODEL_DIR, chajson_path, output_file=None)
return json.dumps(results, ensure_ascii=False, indent=2)
|