Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
import os
|
| 2 |
-
|
| 3 |
-
|
| 4 |
import gradio as gr
|
| 5 |
from TTS.api import TTS
|
| 6 |
-
import torch
|
| 7 |
|
| 8 |
-
#
|
|
|
|
|
|
|
|
|
|
| 9 |
tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2")
|
| 10 |
tts.to("cuda" if torch.cuda.is_available() else "cpu")
|
| 11 |
|
| 12 |
def generate(text, lang, speaker_wav=None):
|
| 13 |
out_path = "output.wav"
|
| 14 |
-
|
| 15 |
if speaker_wav:
|
| 16 |
tts.tts_to_file(
|
| 17 |
text=text,
|
|
@@ -30,13 +30,13 @@ def generate(text, lang, speaker_wav=None):
|
|
| 30 |
demo = gr.Interface(
|
| 31 |
fn=generate,
|
| 32 |
inputs=[
|
| 33 |
-
gr.Textbox(label="
|
| 34 |
gr.Dropdown(choices=["en", "es", "fr", "de", "it", "pt"], label="Language", value="en"),
|
| 35 |
-
gr.
|
| 36 |
],
|
| 37 |
outputs=gr.Audio(type="filepath"),
|
| 38 |
title="🩸 XTTS Horror Voice Generator",
|
| 39 |
-
description="Summon
|
| 40 |
)
|
| 41 |
|
| 42 |
demo.launch()
|
|
|
|
| 1 |
import os
|
| 2 |
+
import torch
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
from TTS.api import TTS
|
|
|
|
| 5 |
|
| 6 |
+
# Accept license
|
| 7 |
+
os.environ["COQUI_TOS_AGREED"] = "1"
|
| 8 |
+
|
| 9 |
+
# Load model
|
| 10 |
tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2")
|
| 11 |
tts.to("cuda" if torch.cuda.is_available() else "cpu")
|
| 12 |
|
| 13 |
def generate(text, lang, speaker_wav=None):
|
| 14 |
out_path = "output.wav"
|
|
|
|
| 15 |
if speaker_wav:
|
| 16 |
tts.tts_to_file(
|
| 17 |
text=text,
|
|
|
|
| 30 |
demo = gr.Interface(
|
| 31 |
fn=generate,
|
| 32 |
inputs=[
|
| 33 |
+
gr.Textbox(label="💀 Type horror line"),
|
| 34 |
gr.Dropdown(choices=["en", "es", "fr", "de", "it", "pt"], label="Language", value="en"),
|
| 35 |
+
gr.File(file_types=["audio"], label="🎙️ Voice Clone (optional)")
|
| 36 |
],
|
| 37 |
outputs=gr.Audio(type="filepath"),
|
| 38 |
title="🩸 XTTS Horror Voice Generator",
|
| 39 |
+
description="Summon cursed voices from the void using cloned horror whispers. Multilingual. GPU-powered. Creepy as hell."
|
| 40 |
)
|
| 41 |
|
| 42 |
demo.launch()
|