Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def clone(text, audio):
|
4 |
-
|
|
|
5 |
|
6 |
iface = gr.Interface(fn=clone,
|
7 |
inputs=["text",gr.Audio(type='filepath')],
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from TTS.api import TTS
|
4 |
+
import os
|
5 |
+
os.environ["COQUI_TOS_AGREED"] = "1"
|
6 |
+
|
7 |
+
device = "cuda"
|
8 |
+
|
9 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
|
10 |
|
11 |
def clone(text, audio):
|
12 |
+
tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path="./output.wav")
|
13 |
+
return "./output.wav"
|
14 |
|
15 |
iface = gr.Interface(fn=clone,
|
16 |
inputs=["text",gr.Audio(type='filepath')],
|