Spaces:
Sleeping
Sleeping
File size: 876 Bytes
72b08c4 b4f714c 72b08c4 0e378f7 72b08c4 0fd39f4 72b08c4 ee06db0 72b08c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import spaces
import gradio as gr
import torch
from TTS.api import TTS
import os
os.environ["COQUI_TOS_AGREED"] = "1"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
@spaces.GPU(enable_queue=True)
def clone(text):
audio = './harry.wav'
tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path="./output.wav")
return "./output.wav"
iface = gr.Interface(fn=clone,
inputs=[gr.Textbox(label='Text')],
outputs=gr.Audio(type='filepath'),
title='Voice Clone',
description="""
❤️
""",
theme = gr.themes.Base(primary_hue="teal",secondary_hue="teal",neutral_hue="slate")
)
iface.launch() |