在生成对话文字时,同时在后台生成tts音频,增加朗读音色选择,增加博物馆的概况接口
This commit is contained in:
@@ -143,7 +143,7 @@ class QwenTTS(Base):
|
||||
from dashscope.audio.tts_v2 import ResultCallback, SpeechSynthesizer, AudioFormat #, SpeechSynthesisResult
|
||||
from dashscope.audio.tts import SpeechSynthesisResult
|
||||
from collections import deque
|
||||
# print(f"--QwenTTS--tts_stream begin-- {text}") # cyx
|
||||
print(f"--QwenTTS--tts_stream begin-- {text}") # cyx
|
||||
class Callback(ResultCallback):
|
||||
def __init__(self) -> None:
|
||||
self.dque = deque()
|
||||
@@ -206,7 +206,7 @@ class QwenTTS(Base):
|
||||
raise RuntimeError(str(response))
|
||||
|
||||
def on_close(self):
|
||||
print("---Qwen call back close") # cyx
|
||||
# print("---Qwen call back close") # cyx
|
||||
pass
|
||||
""" canceled for test 语音大模型CosyVoice
|
||||
def on_event(self, result: SpeechSynthesisResult):
|
||||
@@ -252,7 +252,7 @@ class QwenTTS(Base):
|
||||
try:
|
||||
for data in self.callback._run():
|
||||
yield data
|
||||
print(f"---Qwen return data {num_tokens_from_string(text)}")
|
||||
# print(f"---Qwen return data {num_tokens_from_string(text)}")
|
||||
yield num_tokens_from_string(text)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user