游雁
2024-01-12 bafd056c2831e67aa0f9d8b02832ee160ebb4cc8
examples/industrial_data_pretraining/paraformer_streaming/demo.py
@@ -22,10 +22,8 @@
import soundfile
import os
speech, sample_rate = soundfile.read(os.path.expanduser('~')+
                                     "/.cache/modelscope/hub/damo/"+
                                     "speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online/"+
                                     "example/asr_example.wav")
wav_file = os.path.join(model.model_path, "example/asr_example.wav")
speech, sample_rate = soundfile.read(wav_file)
chunk_stride = chunk_size[1] * 960 # 600ms、480ms
@@ -33,7 +31,7 @@
for i in range(int(len((speech)-1)/chunk_stride+1)):
    speech_chunk = speech[i*chunk_stride:(i+1)*chunk_stride]
    is_final = i == int(len((speech)-1)/chunk_stride+1)
    is_final = i == int(len((speech)-1)/chunk_stride+1) - 1
    res = model(input=speech_chunk,
                cache=cache,
                is_final=is_final,