def speaker_recog_thread(outLabel): global d global On while True: try: g = q.get() now, file_name, data = g now_s = str(now) # if not on: # _, speaker = predict_speaker(file_name) # outLabel.config(text=speaker) # print(now_s, speaker) # if speaker in target_speakers: # on = 1 # else: google_ans = google_stt(file_name) D = np.frombuffer(data, dtype=np.int16) data = librosa.core.resample( 1.0 * D, orig_sr=16000, target_sr=8000).astype(dtype=np.int16).tobytes() systran_ans = asr(data) if google_ans or systran_ans: outLabel.config(text="Google : " + google_ans + '\r\n' + "엘솔루 : " + systran_ans) else: print("empty") # On = True # on -= 1 # outLabel.config(text=speaker + ': ' + out) # print(speaker, out) except queue.Empty: continue
def speech_recog_thread(): global d while True: try: g = q.get() now, data = g now_s = str(now) out = asr(data) print(out) except queue.Empty: continue
def asr_thread(): while True: try: g = q2.get() now, file_name, data, speaker = g D = np.frombuffer(data, dtype=np.int16) data = librosa.core.resample(1.0 * D, orig_sr=16000, target_sr=8000).astype(dtype=np.int16).tobytes() speech = asr(data) if speech: if speech in CESLeA: speech = "CESLeA" # print(speaker, speech) post.post(createdAt=now, speaker=speaker, speakerId=speaker, content=speech) else: # print("empty") except queue.Empty: continue
def asr_thread(outLabel): global speaker global count while True: g = q2.get() if count: now, data = g now_s = str(now) if len(data) < 0.5 * 16000 * 2: continue D = np.frombuffer(data, dtype=np.int16) data = librosa.core.resample( 1.0 * D, orig_sr=16000, target_sr=8000).astype(dtype=np.int16).tobytes() print('run asr') out = asr(data) if out: count = count - 1 print(out) outLabel.config(text=spk[speaker] + ': ' + out) else: print('out is empty')
def speaker_recog_thread(outLabel): global d # on = 0 while True: try: g = q.get() now, file_name, data = g now_s = str(now) _, speaker = predict_speaker(file_name) outLabel.config(text=speaker) print(now_s, speaker) D = np.frombuffer(data, dtype=np.int16) data = librosa.core.resample( 1.0 * D, orig_sr=16000, target_sr=8000).astype(dtype=np.int16).tobytes() out = asr(data) if out: outLabel.config(text=speaker + ': ' + out) print(speaker, out) else: print("empty") pass except queue.Empty: continue