mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
update:删去一些重复、不用的代码
This commit is contained in:
parent
1a411da133
commit
8831ea22b7
1 changed files with 1 additions and 5 deletions
|
|
@ -24,7 +24,7 @@ logger = setup_logging()
|
||||||
|
|
||||||
class ASRProviderBase(ABC):
|
class ASRProviderBase(ABC):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass # 将声纹识别从ASR实例分离,移到连接级别管理
|
pass
|
||||||
|
|
||||||
# 打开音频通道
|
# 打开音频通道
|
||||||
async def open_audio_channels(self, conn):
|
async def open_audio_channels(self, conn):
|
||||||
|
|
@ -96,7 +96,6 @@ class ASRProviderBase(ABC):
|
||||||
def run_asr():
|
def run_asr():
|
||||||
start_time = time.monotonic()
|
start_time = time.monotonic()
|
||||||
try:
|
try:
|
||||||
import asyncio
|
|
||||||
loop = asyncio.new_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
try:
|
try:
|
||||||
|
|
@ -117,9 +116,7 @@ class ASRProviderBase(ABC):
|
||||||
def run_voiceprint():
|
def run_voiceprint():
|
||||||
if not wav_data:
|
if not wav_data:
|
||||||
return None
|
return None
|
||||||
start_time = time.monotonic()
|
|
||||||
try:
|
try:
|
||||||
import asyncio
|
|
||||||
loop = asyncio.new_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
try:
|
try:
|
||||||
|
|
@ -152,7 +149,6 @@ class ASRProviderBase(ABC):
|
||||||
asr_result = asr_future.result(timeout=15)
|
asr_result = asr_future.result(timeout=15)
|
||||||
results = {"asr": asr_result, "voiceprint": None}
|
results = {"asr": asr_result, "voiceprint": None}
|
||||||
|
|
||||||
parallel_execution_time = time.monotonic() - parallel_start_time
|
|
||||||
|
|
||||||
# 处理结果
|
# 处理结果
|
||||||
raw_text, file_path = results.get("asr", ("", None))
|
raw_text, file_path = results.get("asr", ("", None))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue