# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import os import ssl import gradio as gr import torch from loguru import logger ssl._create_default_https_context = ssl._create_unverified_context import nltk nltk.download('cmudict') from parrots import TextToSpeech device = "cuda" if torch.cuda.is_available() else "cpu" logger.info(f"device: {device}") half = True if device == "cuda" else False m = TextToSpeech( speaker_model_path="shibing624/parrots-gpt-sovits-speaker-maimai", speaker_name="MaiMai", device=device, half=half ) m.predict( text="你好,欢迎来北京。welcome to the city.", text_language="auto", output_path="output_audio.wav" ) assert os.path.exists("output_audio.wav") def do_tts_wav_predict(text): audio_array = m.predict(text, text_language="auto") yield audio_array with gr.Blocks(title="parrots WebUI") as app: gr.Markdown(value=""" #