From 65c18785016c099f40ff626c2c6a7dac91c3426f Mon Sep 17 00:00:00 2001
From: zhaomingwork <61895407+zhaomingwork@users.noreply.github.com>
Date: 星期二, 01 八月 2023 08:54:20 +0800
Subject: [PATCH] add is_final for python_ws_srv (#794)

---
 funasr/runtime/python/websocket/funasr_wss_client.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/funasr/runtime/python/websocket/funasr_wss_client.py b/funasr/runtime/python/websocket/funasr_wss_client.py
index 264014f..5830db4 100644
--- a/funasr/runtime/python/websocket/funasr_wss_client.py
+++ b/funasr/runtime/python/websocket/funasr_wss_client.py
@@ -222,7 +222,11 @@
                 # text_print = text_print[-args.words_max_print:]
                 # os.system('clear')
                 print("\rpid" + str(id) + ": " + wav_name + ": " + text_print)
-                offline_msg_done = True
+                if ("is_final" in meg and meg["is_final"]==False):
+                    offline_msg_done = True
+                
+                if not "is_final" in meg:
+                    offline_msg_done = True
             else:
                 if meg["mode"] == "2pass-online":
                     text_print_2pass_online += "{}".format(text)

--
Gitblit v1.9.1