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

Method wait_for_result

runtime/funasr_api/funasr_core.py:196–215  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

194 print("rec_file",e)
195 return
196 def wait_for_result(self):
197 try:
198 timeout=self.timeout
199
200 file_dur=self.rec_file_len/16000/2*100
201 if file_dur>timeout:
202 timeout=file_dur
203 self.timeout=timeout
204 #print("wait_for_result timeout=",timeout)
205
206 # if file_dur==0 means in stream way and no timeout
207 while(self.is_final==False and (timeout>0 or file_dur==0 )):
208 time.sleep(0.01)
209 timeout=timeout-1
210
211 if timeout<=0 and not file_dur==0:
212 print("time out!",self.timeout)
213 except Exception as e:
214 print("wait_for_result",e)
215 return
216 def get_result(self):
217 try:
218 message = json.dumps({"is_speaking": False})

Callers 2

get_resultMethod · 0.95
wait_for_endMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected