From 8912e0696af069de47646fdb8a9d9c4e086e88b3 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期日, 14 一月 2024 23:42:11 +0800
Subject: [PATCH] Resolve merge conflict
---
runtime/python/websocket/funasr_wss_client.py | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/runtime/python/websocket/funasr_wss_client.py b/runtime/python/websocket/funasr_wss_client.py
index bfe4b0d..92dc548 100644
--- a/runtime/python/websocket/funasr_wss_client.py
+++ b/runtime/python/websocket/funasr_wss_client.py
@@ -186,13 +186,6 @@
if wav_path.endswith(".pcm"):
with open(wav_path, "rb") as f:
audio_bytes = f.read()
- elif wav_path.endswith(".wav"):
- import wave
- with wave.open(wav_path, "rb") as wav_file:
- params = wav_file.getparams()
- sample_rate = wav_file.getframerate()
- frames = wav_file.readframes(wav_file.getnframes())
- audio_bytes = bytes(frames)
else:
wav_format = "others"
with open(wav_path, "rb") as f:
@@ -256,6 +249,7 @@
wav_name = meg.get("wav_name", "demo")
text = meg["text"]
timestamp=""
+ offline_msg_done = meg.get("is_final", False)
if "timestamp" in meg:
timestamp = meg["timestamp"]
@@ -265,7 +259,9 @@
else:
text_write_line = "{}\t{}\n".format(wav_name, text)
ibest_writer.write(text_write_line)
-
+
+ if 'mode' not in meg:
+ continue
if meg["mode"] == "online":
text_print += "{}".format(text)
text_print = text_print[-args.words_max_print:]
@@ -292,7 +288,7 @@
text_print = text_print[-args.words_max_print:]
os.system('clear')
print("\rpid" + str(id) + ": " + text_print)
- offline_msg_done=True
+ # offline_msg_done=True
except Exception as e:
print("Exception:", e)
--
Gitblit v1.9.1