Spaces:
Running
on
Zero
Running
on
Zero
Create app.copy
Browse files
app.copy
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import spaces
|
2 |
+
import gradio as gr
|
3 |
+
import torch
|
4 |
+
from TTS.api import TTS
|
5 |
+
import os
|
6 |
+
os.environ["COQUI_TOS_AGREED"] = "1"
|
7 |
+
|
8 |
+
device = "cuda"
|
9 |
+
|
10 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
|
11 |
+
|
12 |
+
@spaces.GPU(enable_queue=True)
|
13 |
+
def clone(text, audio):
|
14 |
+
tts.tts_to_file(text=text, speaker_wav=audio, language="pl", file_path="./output.wav")
|
15 |
+
return "./output.wav"
|
16 |
+
|
17 |
+
iface = 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 |
+
theme = gr.themes.Base(primary_hue="teal",secondary_hue="teal",neutral_hue="slate"))
|
22 |
+
iface.launch()
|