Skip to content

Commit

Permalink
author:yijinsheng wss_client_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lyblsgo committed Dec 15, 2023
1 parent b0b796f commit 3c2d793
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions runtime/python/websocket/funasr_wss_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ async def message(id):
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"]

Expand All @@ -265,7 +266,9 @@ async def message(id):
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:]
Expand All @@ -292,7 +295,7 @@ async def message(id):
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)
Expand Down

0 comments on commit 3c2d793

Please sign in to comment.