From 911d450a596a711d6faea37c2abfba13d3a511fd Mon Sep 17 00:00:00 2001
From: haoneng.lhn <haoneng.lhn@alibaba-inc.com>
Date: 星期四, 27 四月 2023 14:15:11 +0800
Subject: [PATCH] Merge branch 'dev_lhn' into dev_websocket
---
funasr/runtime/python/websocket/ASR_server.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/funasr/runtime/python/websocket/ASR_server.py b/funasr/runtime/python/websocket/ASR_server.py
index 9344f38..c717e71 100644
--- a/funasr/runtime/python/websocket/ASR_server.py
+++ b/funasr/runtime/python/websocket/ASR_server.py
@@ -4,6 +4,7 @@
from queue import Queue
import threading
import argparse
+import json
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
@@ -144,7 +145,7 @@
def asr(websocket): # ASR鎺ㄧ悊
- global inference_pipeline2
+ global inference_pipeline_asr, inference_pipeline_punc
# global param_dict_punc
global websocket_users
while websocket in websocket_users:
@@ -157,12 +158,13 @@
rec_result = inference_pipeline_punc(text_in=rec_result['text'], param_dict=websocket.param_dict_punc)
# print(rec_result)
if "text" in rec_result:
- websocket.send_msg.put(rec_result["text"]) # 瀛樺叆鍙戦�侀槦鍒� 鐩存帴璋冪敤send鍙戦�佷笉浜�
+ message = json.dumps({"mode": "offline", "text": rec_result["text"]})
+ websocket.send_msg.put(message) # 瀛樺叆鍙戦�侀槦鍒� 鐩存帴璋冪敤send鍙戦�佷笉浜�
time.sleep(0.1)
def vad(data, websocket): # VAD鎺ㄧ悊
- global vad_pipline, param_dict_vad
+ global inference_pipeline_vad
#print(type(data))
# print(param_dict_vad)
segments_result = inference_pipeline_vad(audio_in=data, param_dict=websocket.param_dict_vad)
--
Gitblit v1.9.1