SAD43W commited on
Commit
95ab1d7
·
verified ·
1 Parent(s): 67f14ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -1,9 +1,12 @@
 
 
 
1
  import gradio as gr
2
  from TTS.api import TTS
3
- import os
4
 
5
- # Load the model
6
- tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2", gpu=True)
 
7
 
8
  def generate(text, lang, speaker_wav=None):
9
  out_path = "output.wav"
@@ -26,13 +29,13 @@ def generate(text, lang, speaker_wav=None):
26
  demo = gr.Interface(
27
  fn=generate,
28
  inputs=[
29
- gr.Textbox(label="Horror Text"),
30
  gr.Dropdown(choices=["en", "es", "fr", "de", "it", "pt"], label="Language", value="en"),
31
- gr.Audio(source="upload", type="filepath", label="🎙 Voice Clone (optional)")
32
  ],
33
  outputs=gr.Audio(type="filepath"),
34
- title="👻 XTTS Horror Voice Generator",
35
- description="Type some cursed text, clone a scary voice, and summon audio from the void."
36
  )
37
 
38
  demo.launch()
 
1
+ import os
2
+ os.environ["COQUI_TOS_AGREED"] = "1" # Auto-accept license
3
+
4
  import gradio as gr
5
  from TTS.api import TTS
 
6
 
7
+ # Load model (note .to() instead of gpu=True)
8
+ tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2")
9
+ tts.to("cuda" if torch.cuda.is_available() else "cpu")
10
 
11
  def generate(text, lang, speaker_wav=None):
12
  out_path = "output.wav"
 
29
  demo = gr.Interface(
30
  fn=generate,
31
  inputs=[
32
+ gr.Textbox(label="👻 Enter horror text here"),
33
  gr.Dropdown(choices=["en", "es", "fr", "de", "it", "pt"], label="Language", value="en"),
34
+ gr.Audio(source="upload", type="filepath", label="🎙️ Voice Clone (optional)")
35
  ],
36
  outputs=gr.Audio(type="filepath"),
37
+ title="🩸 XTTS Horror Voice Generator",
38
+ description="Summon realistic demonic speech from your text, clone voices, and whisper like a beast from the void."
39
  )
40
 
41
  demo.launch()