mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
funasr1.0 streaming
This commit is contained in:
parent
bafd056c28
commit
38524b21d9
@ -26,9 +26,10 @@ chunk_stride = int(chunk_size * 16000 / 1000)
|
|||||||
|
|
||||||
cache = {}
|
cache = {}
|
||||||
|
|
||||||
for i in range(int(len((speech)-1)/chunk_stride+1)):
|
total_chunk_num = int(len((speech)-1)/chunk_stride+1)
|
||||||
|
for i in range(total_chunk_num):
|
||||||
speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride]
|
speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride]
|
||||||
is_final = i == int(len((speech)-1)/chunk_stride+1) - 1
|
is_final = i == total_chunk_num - 1
|
||||||
res = model(input=speech_chunk,
|
res = model(input=speech_chunk,
|
||||||
cache=cache,
|
cache=cache,
|
||||||
is_final=is_final,
|
is_final=is_final,
|
||||||
|
|||||||
@ -28,10 +28,10 @@ speech, sample_rate = soundfile.read(wav_file)
|
|||||||
chunk_stride = chunk_size[1] * 960 # 600ms、480ms
|
chunk_stride = chunk_size[1] * 960 # 600ms、480ms
|
||||||
|
|
||||||
cache = {}
|
cache = {}
|
||||||
|
total_chunk_num = int(len((speech)-1)/chunk_stride+1)
|
||||||
for i in range(int(len((speech)-1)/chunk_stride+1)):
|
for i in range(total_chunk_num):
|
||||||
speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride]
|
speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride]
|
||||||
is_final = i == int(len((speech)-1)/chunk_stride+1) - 1
|
is_final = i == total_chunk_num - 1
|
||||||
res = model(input=speech_chunk,
|
res = model(input=speech_chunk,
|
||||||
cache=cache,
|
cache=cache,
|
||||||
is_final=is_final,
|
is_final=is_final,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user