From f0c7a026305ace410610c9dba771699e13dde8ea Mon Sep 17 00:00:00 2001 From: Chun Tao Date: Mon, 7 Oct 2024 00:41:28 +0000 Subject: [PATCH] updates needed for demo Signed-off-by: Chun Tao --- comps/cores/mega/gateway.py | 6 ++++-- comps/tts/speecht5/dependency/speecht5_model.py | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/comps/cores/mega/gateway.py b/comps/cores/mega/gateway.py index 115658e31..54bc6ab6d 100644 --- a/comps/cores/mega/gateway.py +++ b/comps/cores/mega/gateway.py @@ -419,8 +419,10 @@ async def handle_request(self, request: Request): ) last_node = runtime_graph.all_leaves()[-1] - response = result_dict[last_node]["byte_str"] - + #response = result_dict[last_node]["byte_str"] + response = {"byte_str": result_dict[last_node]["byte_str"], + "text": result_dict["llm/MicroService"]["text"], + "query": result_dict["asr/MicroService"]["query"]} return response diff --git a/comps/tts/speecht5/dependency/speecht5_model.py b/comps/tts/speecht5/dependency/speecht5_model.py index 8a800d68d..20ae8f0d4 100644 --- a/comps/tts/speecht5/dependency/speecht5_model.py +++ b/comps/tts/speecht5/dependency/speecht5_model.py @@ -51,6 +51,9 @@ def __init__(self, device="cpu"): def split_long_text_into_batch(self, text, batch_length=128): """Batch the long text into sequences of shorter sentences.""" + # ctao - Replace AI with "A, I" + text = text.replace("AI", "A, I") + text = text.replace("OPEX", "OPEA") res = [] hitted_ends = [",", ".", "?", "!", "。", ";", " "] idx = 0