当前位置: 首页 > news >正文

重庆做网站及优化报价酒店的网络营销是什么

重庆做网站及优化报价,酒店的网络营销是什么,个人公众号如何开通,网站开发计划时间WeNet语音识别Qwen-72B-Chat Bot#x1f47e;Sambert-Hifigan语音合成 简介 利用 WeNet 进行语音识别#xff0c;使用户能够通过语音输入与系统进行交互。接着#xff0c;Qwen-72B-Chat Bot作为聊天机器人接收用户的语音输入或文本输入#xff0c;提供响应并与用户进行对话…WeNet语音识别Qwen-72B-Chat BotSambert-Hifigan语音合成 简介 利用 WeNet 进行语音识别使用户能够通过语音输入与系统进行交互。接着Qwen-72B-Chat Bot作为聊天机器人接收用户的语音输入或文本输入提供响应并与用户进行对话。最后系统利用 Sambert-Hifigan 进行语音合成将机器人的响应转换为自然流畅的语音输出使用户能够以语音方式接收机器人的回复。 特点 对话记忆功能 该系统能够记忆和追踪用户和聊天机器人之间的对话历史。这使得用户能够在对话中随时回顾之前的交流内容从而实现更连贯的对话和更好的交互体验。 多语音模型切换 该系统支持多种语音模型的切换。用户可以根据需要选择不同的语音模型进行交互。这种多语音模型切换功能使得系统在不同语境下有更强的适用性和灵活性。 界面 体验一下 环境配置 完整代码 import os os.system(pip install dashscope) os.system(pip install modelscope) import gradio as gr from http import HTTPStatus import dashscope from dashscope import Generation from dashscope.api_entities.dashscope_response import Role from typing import List, Optional, Tuple, Dict from urllib.error import HTTPError import wenet from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasksdefault_system You are a helpful assistant. chs_model wenet.load_model(chinese) YOUR_API_TOKEN os.getenv(YOUR_API_TOKEN) dashscope.api_key YOUR_API_TOKEN History List[Tuple[str, str]] Messages List[Dict[str, str]]# 加载四个不同的语音合成模型 sambert_hifigan_zh_model_id damo/speech_sambert-hifigan_tts_zh-cn_16k sambert_hifigan_zh pipeline(taskTasks.text_to_speech, modelsambert_hifigan_zh_model_id)sambert_hifigan_ch_model_id speech_tts/speech_sambert-hifigan_tts_chuangirl_Sichuan_16k sambert_hifigan_ch pipeline(taskTasks.text_to_speech, modelsambert_hifigan_ch_model_id)sambert_hifigan_ca_model_id speech_tts/speech_sambert-hifigan_tts_jiajia_Cantonese_16k sambert_hifigan_ca pipeline(taskTasks.text_to_speech, modelsambert_hifigan_ca_model_id)sambert_hifigan_ws_model_id speech_tts/speech_sambert-hifigan_tts_xiaoda_WuuShanghai_16k sambert_hifigan_ws pipeline(taskTasks.text_to_speech, modelsambert_hifigan_ws_model_id)def clear_session() - History:return []def modify_system_session(system: str) - str:if system is None or len(system) 0:system default_systemreturn system, system, []def history_to_messages(history: History, system: str) - Messages:messages [{role: Role.SYSTEM, content: system}]for h in history:messages.append({role: Role.USER, content: h[0]})messages.append({role: Role.ASSISTANT, content: h[1]})return messagesdef messages_to_history(messages: Messages) - Tuple[str, History]:assert messages[0][role] Role.SYSTEMsystem messages[0][content]history []for q, r in zip(messages[1::2], messages[2::2]):history.append([q[content], r[content]])return system, historydef model_chat(path:str, history: Optional[History], system: str,model:str,voice:str ) - Tuple[str, str, History]:if path is not None:query chs_model.transcribe(path)[text]if query is None:query if history is None:history []messages history_to_messages(history, system)messages.append({role: Role.USER, content: query})gen Generation.call(model qwen-72b-chat,messagesmessages,result_formatmessage,streamTrue)for response in gen:if response.status_code HTTPStatus.OK:role response.output.choices[0].message.roleresponse response.output.choices[0].message.contentsystem, history messages_to_history(messages [{role: role, content: response}])else:raise HTTPError(Request id: %s, Status code: %s, error code: %s, error message: %s % (response.request_id, response.status_code,response.code, response.message))outputNone# 进行语音合成sambert_hifigan_tts_model {默认: sambert_hifigan_zh,四川话: sambert_hifigan_ch,粤语: sambert_hifigan_ca,上海话: sambert_hifigan_ws}# 使用对应的语音合成模型进行合成sambert_hifigan_tts sambert_hifigan_tts_model.get(model)if model 默认:output sambert_hifigan_tts(inputresponse, voicevoice)else:output sambert_hifigan_tts(inputresponse)wav output[OutputKeys.OUTPUT_WAV]path output.wavwith open(path, wb) as f:f.write(wav)return history, system, pathdef update_dropdowns(model,voice): if model 默认: voicegr.Dropdown(choices[zhitian_emo, zhiyan_emo, zhizhe_emo, zhibei_emo], valuezhitian_emo,label声音,visibleTrue) else: voicegr.Dropdown(choices[zhitian_emo, zhiyan_emo, zhizhe_emo, zhibei_emo], valuezhitian_emo,label声音,visibleFalse)return voice with gr.Blocks() as demo:gr.Markdown(p aligncenterimg srchttps://modelscope.cn/api/v1/models/qwen/Qwen-VL-Chat/repo?RevisionmasterFilePathassets/logo.jpgViewtrue styleheight: 80px/p)gr.Markdown(centerfont size4WeNet语音识别Qwen-72B-Chat BotSambert-Hifigan语音合成/center)textbox gr.Microphone(typefilepath,label录音)with gr.Row():with gr.Column(scale3):system_input gr.Textbox(valuedefault_system, lines1, labelSystem, visibleFalse)with gr.Column(scale1):modify_system gr.Button(️ 设置system并清除历史对话, scale2, visibleFalse)system_state gr.Textbox(valuedefault_system, visibleFalse)chatbot gr.Chatbot(labelQwen-72B-Chat, visibleFalse)modelgr.Dropdown(choices[默认, 四川话, 粤语, 上海话], value默认,label声音模型)voice gr.Dropdown(choices[zhitian_emo, zhiyan_emo, zhizhe_emo, zhibei_emo], valuezhitian_emo,label声音)audio_output gr.Audio(typefilepath,label输出音频,autoPlayTrue)with gr.Row():clear_history gr.Button( 清除记忆)sumbit gr.Button( 发送)model.change(update_dropdowns,inputs[model,voice],outputs[voice])sumbit.click(model_chat,inputs[textbox, chatbot, system_state,model,voice],outputs[chatbot, system_input,audio_output],concurrency_limit10)clear_history.click(fnclear_session,inputs[],outputs[chatbot],concurrency_limit10)modify_system.click(fnmodify_system_session,inputs[system_input],outputs[system_state, system_input, chatbot],concurrency_limit10) demo.queue(api_openFalse).launch(height800, shareFalse)
http://www.pierceye.com/news/308707/

相关文章:

  • 网站开发参考文献2015年后出售网站平台
  • 做外国网站买域名上海网站建设的英文
  • 好看的静态网站信产部网站备案
  • 怎样建设网站 需要哪些条件wordpress安装主题要多久
  • 高端网站设计平台高端网站设计企业印象笔记wordpress同步
  • 汽车网站建设的目的公司简介模板设计图片
  • 做外贸的社交网站怎么攻击网站吗
  • 网站布局手机百度网址大全
  • 企业网站做多大擦边球做网站挣钱
  • 网站怎么备份做网站建设要学多久
  • 怎样做买东西的网站外汇期货喊单网站怎么做的
  • 博客网站推荐郑州哪里做网站
  • 贵州建设职业技术学院网站网站开发 多语言
  • 网站后台管理系统怎么进重庆建设工程安全管理局网站
  • 移动网站开发的视频下载百度网盘下载官网
  • 在百度备案网站建设工程检测网
  • 广州企业网站营销电话公司网站怎么做啊
  • 如何利用视频网站做推广网站开发管理学什么
  • 福建漳发建设有限公司网站做网站申请什么商标
  • 专门做房产的网站上海网站开发毕业生
  • 网站域名已经解析但没有被百度等搜索引擎收录怎么办可以做投票功能的网站
  • 重庆网站设计总部什么是社交电商平台
  • 内容管理网站百度电商平台
  • 网站建设 万网网站统计插件
  • 怎么个人网站设计网站建设 不违背
  • 图片下载网站郑州联通网站备案
  • 名师工作室网站建设 意义o2o新零售系统
  • 域名查询权威网站网页设计基础填空题及答案
  • 网站建设策划方案如何写新开传奇新服网
  • dedecms网站上传服务器不是空间网站正则表达式怎么做