MCPcopy Create free account
hub / github.com/modelscope/FunASR / main

Function main

tests_models/test_fsmn_vad.py:6–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import time
5
6def 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
30if __name__ == "__main__":
31 sys.exit(main())

Callers 1

test_fsmn_vad.pyFile · 0.70

Calls 2

generateMethod · 0.95
AutoModelClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…