Spaces:
Runtime error
Runtime error
| import spaces | |
| import gradio as gr | |
| import torch | |
| from TTS.api import TTS | |
| import os | |
| os.environ["COQUI_TOS_AGREED"] = "1" | |
| device = "cuda" | |
| tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device) | |
| def clone(text, audio): | |
| tts.tts_to_file(text=text, speaker_wav=audio, language="zh-cn", file_path="./output.wav") | |
| return "./output.wav" | |
| iface = gr.Interface( | |
| fn=clone, | |
| inputs=[ | |
| gr.Textbox(label='Text'), | |
| gr.Audio(type='filepath', label='Voice reference audio file') | |
| ], | |
| outputs=gr.Audio(type='filepath'), | |
| title='Voice Clone', | |
| description="CoolAI", | |
| examples=[ | |
| ["我不敢苟同他的观点,我个人认为这个意大利面就应该拌42号混凝土,因为这个螺丝钉的长度,它很容易会直接影响到挖掘机的扭矩,你知道吧。你往里砸的时候,一瞬间它就会产生大量的高能蛋白,俗称UFO,会严重影响经济的发展,甚至对这个太平洋以及充电器都会造成一定的核污染。", "./audio/Eric.WAV"], | |
| ] | |
| ) | |
| iface.launch() |