Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,20 @@
|
|
|
|
1 |
from TTS.api import TTS
|
2 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Initialize the TTS model
|
5 |
-
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2"
|
|
|
|
|
6 |
|
7 |
@spaces.GPU
|
8 |
def generate_speech(text, speaker_wav, language):
|
|
|
1 |
+
import torch
|
2 |
from TTS.api import TTS
|
3 |
import gradio as gr
|
4 |
+
import os
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
# Agree to Terms of service
|
9 |
+
os.environ["COQUI_TOS_AGREED"] = "1"
|
10 |
+
|
11 |
+
# Get device
|
12 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
13 |
|
14 |
# Initialize the TTS model
|
15 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
|
16 |
+
|
17 |
+
|
18 |
|
19 |
@spaces.GPU
|
20 |
def generate_speech(text, speaker_wav, language):
|