CoolFace
Apppublic

ale-neto/voice-br

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
app.py28 linesDownload Raw Back to root
1import spaces2import gradio as gr3import torch4from TTS.api import TTS5import os6os.environ["COQUI_TOS_AGREED"] = "1"7 8device = "cuda"9 10tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)11 12@spaces.GPU(enable_queue=True)13def clone(text, audio):14    tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path="./output.wav")15    return "./output.wav"16 17iface = gr.Interface(fn=clone,18                     inputs=[gr.Textbox(label='Text'),gr.Audio(type='filepath', label='Voice reference audio file')],19                     outputs=gr.Audio(type='filepath'),20                     title='Voice Clone',21                     description="""22 23                     Please ❤️ this Space. I build custom AI apps for companies. <a href="mailto: tony.assi.media@gmail.com">Email me</a> for business inquiries.24                     """,25                     theme = gr.themes.Base(primary_hue="teal",secondary_hue="teal",neutral_hue="slate"),26                  )27iface.launch()28