()
| 4 | import time |
| 5 | |
| 6 | def main(): |
| 7 | from funasr import AutoModel |
| 8 | |
| 9 | print("[FSMN-VAD] Loading model...") |
| 10 | t0 = time.time() |
| 11 | model = AutoModel(model="iic/speech_fsmn_vad_zh-cn-16k-common-pytorch", device="cpu", disable_update=True) |
| 12 | print("[FSMN-VAD] Model loaded in %.1fs" % (time.time()-t0)) |
| 13 | |
| 14 | print("[FSMN-VAD] Running inference...") |
| 15 | t0 = time.time() |
| 16 | res = model.generate( |
| 17 | input="https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav", |
| 18 | ) |
| 19 | print("[FSMN-VAD] Inference done in %.1fs" % (time.time()-t0)) |
| 20 | print("[FSMN-VAD] Result: %s" % res) |
| 21 | |
| 22 | if res and len(res) > 0 and "value" in res[0]: |
| 23 | print("[FSMN-VAD] Detected %d speech segments" % len(res[0]["value"])) |
| 24 | print("[FSMN-VAD] PASSED") |
| 25 | return 0 |
| 26 | else: |
| 27 | print("[FSMN-VAD] FAILED - no VAD segments detected") |
| 28 | return 1 |
| 29 | |
| 30 | if __name__ == "__main__": |
| 31 | sys.exit(main()) |
no test coverage detected
searching dependent graphs…