Spaces:
No application file

File size: 653 Bytes
f37134c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 gradio as gr
from TTS.api import TTS

tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2")

def clone_voice(text, audio):
    output_path = "output.wav"
    tts.tts_to_file(
        text=text,
        speaker_wav=audio,
        language="en",
        file_path=output_path
    )
    return output_path

ui = gr.Interface(
    fn=clone_voice,
    inputs=[
        gr.Textbox(label="Text to Speak"),
        gr.Audio(type="filepath", label="Upload Your Voice Sample")
    ],
    outputs=gr.Audio(label="Cloned Voice Output"),
    title="Open Voice Clone",
    description="Only upload voices you own or have permission to use."
)

ui.launch()