Spaces:
Sleeping
Sleeping
| 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) | |