Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import gradio as gr
|
|
| 3 |
from TTS.tts.configs.xtts_config import XttsConfig
|
| 4 |
from TTS.tts.models.xtts import Xtts
|
| 5 |
from huggingface_hub import snapshot_download
|
|
|
|
| 6 |
|
| 7 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
| 8 |
|
|
@@ -18,6 +19,7 @@ model = Xtts.init_from_config(config)
|
|
| 18 |
model.load_checkpoint(config, checkpoint_dir="XTTS-v2", eval=True)
|
| 19 |
print("Model loaded successfully on CPU!")
|
| 20 |
|
|
|
|
| 21 |
def clone_voice(text, language, reference_audio):
|
| 22 |
if not text or not reference_audio:
|
| 23 |
return None
|
|
@@ -34,7 +36,7 @@ demo = gr.Interface(
|
|
| 34 |
gr.Audio(label="Reference Audio (3-15 seconds)", type="filepath")
|
| 35 |
],
|
| 36 |
outputs=gr.Audio(label="Generated Speech"),
|
| 37 |
-
title="XTTS v2 Voice Cloning
|
| 38 |
description="Clone any voice from a 3-15 second audio sample. Supports 16 languages."
|
| 39 |
)
|
| 40 |
|
|
|
|
| 3 |
from TTS.tts.configs.xtts_config import XttsConfig
|
| 4 |
from TTS.tts.models.xtts import Xtts
|
| 5 |
from huggingface_hub import snapshot_download
|
| 6 |
+
import spaces
|
| 7 |
|
| 8 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
| 9 |
|
|
|
|
| 19 |
model.load_checkpoint(config, checkpoint_dir="XTTS-v2", eval=True)
|
| 20 |
print("Model loaded successfully on CPU!")
|
| 21 |
|
| 22 |
+
@spaces.GPU
|
| 23 |
def clone_voice(text, language, reference_audio):
|
| 24 |
if not text or not reference_audio:
|
| 25 |
return None
|
|
|
|
| 36 |
gr.Audio(label="Reference Audio (3-15 seconds)", type="filepath")
|
| 37 |
],
|
| 38 |
outputs=gr.Audio(label="Generated Speech"),
|
| 39 |
+
title="XTTS v2 Voice Cloning",
|
| 40 |
description="Clone any voice from a 3-15 second audio sample. Supports 16 languages."
|
| 41 |
)
|
| 42 |
|