游雁
2023-03-23 1c318519b2539db279406815207f6ff66ac2ad62
websocket
2个文件已修改
8 ■■■■ 已修改文件
funasr/runtime/python/websocket/ASR_client.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/python/websocket/ASR_server.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/python/websocket/ASR_client.py
@@ -1,10 +1,10 @@
import pyaudio
import websocket #区别服务端这里是 websocket-client库
# import websocket #区别服务端这里是 websocket-client库
import time
import websockets
import asyncio
from queue import Queue
import threading
# import threading
voices = Queue()
async def hello():
    global ws # 定义一个全局变量ws,用于保存websocket连接对象
funasr/runtime/python/websocket/ASR_server.py
@@ -10,7 +10,7 @@
import websockets  #区别客户端这里是 websockets库
import time
from queue import Queue
import  threading
import threading
print("model loading")
voices = Queue()
@@ -95,7 +95,7 @@
                frames.append(data)
                RECORD_NUM += 1    
            
            if  vad(data):
            if vad(data):
                if not speech_detected:
                    print("检测到人声...")
                    speech_detected = True  # 标记为检测到语音