Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from TTS.api import TTS
|
| 3 |
import tempfile
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def generate_tts(text, speaker_wav, mic_wav, language, similarity):
|
| 9 |
if not text:
|
|
@@ -18,8 +22,6 @@ def generate_tts(text, speaker_wav, mic_wav, language, similarity):
|
|
| 18 |
output_path = tempfile.mktemp(suffix=".wav")
|
| 19 |
|
| 20 |
# Run TTS
|
| 21 |
-
# "speaker_similarity" is an alias for controlling conditioning
|
| 22 |
-
# Higher similarity => stronger cloning (less flexible)
|
| 23 |
tts.tts_to_file(
|
| 24 |
text=text,
|
| 25 |
file_path=output_path,
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
from TTS.api import TTS
|
| 4 |
import tempfile
|
| 5 |
|
| 6 |
+
# ✅ Automatically accept Coqui TTS license
|
| 7 |
+
os.environ["COQUI_TOS_AGREED"] = "1"
|
| 8 |
+
|
| 9 |
+
# Load model (GPU if available, set gpu=False if running CPU-only)
|
| 10 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=False)
|
| 11 |
|
| 12 |
def generate_tts(text, speaker_wav, mic_wav, language, similarity):
|
| 13 |
if not text:
|
|
|
|
| 22 |
output_path = tempfile.mktemp(suffix=".wav")
|
| 23 |
|
| 24 |
# Run TTS
|
|
|
|
|
|
|
| 25 |
tts.tts_to_file(
|
| 26 |
text=text,
|
| 27 |
file_path=output_path,
|