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

Function recognizer_example

runtime/funasr_api/example.py:11–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9import wave
10
11def recognizer_example():
12 # create an recognizer
13 rcg = FunasrApi(
14 uri="wss://www.funasr.com:10096/"
15 )
16 # recognizer by filepath
17 text=rcg.rec_file("asr_example.mp3")
18 print("recognizer by filepath result=",text)
19
20
21 # recognizer by buffer
22 # rec_buf(audio_buf,ffmpeg_decode=False),set ffmpeg_decode=True if audio is not PCM or WAV type
23 with open("asr_example.wav", "rb") as f:
24 audio_bytes = f.read()
25 text=rcg.rec_buf(audio_bytes)
26 print("recognizer by buffer result=",text)
27
28def recognizer_stream_example():
29

Callers 1

example.pyFile · 0.85

Calls 4

rec_fileMethod · 0.95
rec_bufMethod · 0.95
FunasrApiClass · 0.90
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…