MCPcopy Index your code
hub / github.com/modelscope/FunASR / main

Function main

tests_models/test_campplus.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("[CAM++] Loading model...")
10 t0 = time.time()
11 model = AutoModel(model="iic/speech_campplus_sv_zh-cn_16k-common", device="cpu", disable_update=True)
12 print("[CAM++] Model loaded in %.1fs" % (time.time()-t0))
13
14 print("[CAM++] Extracting speaker embedding...")
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("[CAM++] Inference done in %.1fs" % (time.time()-t0))
20
21 if res and len(res) > 0:
22 spk_embedding = res[0].get("spk_embedding", None)
23 if spk_embedding is not None:
24 print("[CAM++] Embedding shape: %s" % str(spk_embedding.shape))
25 print("[CAM++] PASSED")
26 return 0
27 print("[CAM++] FAILED - no speaker embedding")
28 return 1
29
30if __name__ == "__main__":
31 sys.exit(main())

Callers 1

test_campplus.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…