From c00336e11581165329557097cb29e5e05d5a31fd Mon Sep 17 00:00:00 2001
From: zhaomingwork <zhaomingwork@qq.com>
Date: 星期一, 15 五月 2023 22:32:34 +0800
Subject: [PATCH] add fire engine manually
---
funasr/runtime/python/websocket/parse_args.py | 12 +++++++++++-
funasr/runtime/python/websocket/ws_server_online.py | 5 ++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/funasr/runtime/python/websocket/parse_args.py b/funasr/runtime/python/websocket/parse_args.py
index d170be8..bfa5a87 100644
--- a/funasr/runtime/python/websocket/parse_args.py
+++ b/funasr/runtime/python/websocket/parse_args.py
@@ -35,6 +35,16 @@
type=int,
default=1,
help="cpu cores")
-
+parser.add_argument("--certfile",
+ type=str,
+ default="",
+ required=False,
+ help="certfile for ssl")
+
+parser.add_argument("--keyfile",
+ type=str,
+ default="",
+ required=False,
+ help="keyfile for ssl")
args = parser.parse_args()
print(args)
\ No newline at end of file
diff --git a/funasr/runtime/python/websocket/ws_server_online.py b/funasr/runtime/python/websocket/ws_server_online.py
index ba50f62..16a3abe 100644
--- a/funasr/runtime/python/websocket/ws_server_online.py
+++ b/funasr/runtime/python/websocket/ws_server_online.py
@@ -53,6 +53,9 @@
if "is_speaking" in messagejson:
websocket.is_speaking = messagejson["is_speaking"]
websocket.param_dict_asr_online["is_final"] = not websocket.is_speaking
+ # need to fire engine manually if no data received any more
+ if not websocket.is_speaking:
+ await async_asr_online(websocket,b"")
if "chunk_interval" in messagejson:
websocket.chunk_interval=messagejson["chunk_interval"]
if "wav_name" in messagejson:
@@ -82,7 +85,7 @@
async def async_asr_online(websocket,audio_in):
- if len(audio_in) > 0:
+ if len(audio_in) >=0:
audio_in = load_bytes(audio_in)
rec_result = inference_pipeline_asr_online(audio_in=audio_in,
param_dict=websocket.param_dict_asr_online)
--
Gitblit v1.9.1