import gradio as gr import hashlib import tempfile import requests from TTS.utils.manage import ModelManager from TTS.utils.synthesizer import Synthesizer def fx(x:str): hash=hashlib.md5() hash.update(x.encode(encoding='utf-8')) return hash.hexdigest() manager = ModelManager() model_path, config_path, model_item = manager.download_model("tts_models/zh-CN/baker/tacotron2-DDC-GST") synthesizer = Synthesizer( model_path, config_path, None, None, None, ) def inference(text: str): wavs = synthesizer.tts(text) with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp: synthesizer.save_wav(wavs, fp) return fp.name def fx_m(s:str): headers= {"Content-Type": "application/json"} url="https://m-formatter.azurewebsites.net/api/v2" data={'code':s,'resultType':'text'} respose=requests.post(url,json=data,headers=headers) ms=respose.json() return ms['result'] def fx_dax(s:str): url="https://www.daxformatter.com/" data = {"embed":"1","l":"short","fx":s} ct=requests.post(url = url,data = data) html=ct.text s1=html.split('