VoiceCloning-be commited on
Commit
a9d116f
1 Parent(s): 5df6ee2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import subprocess
2
-
3
  # Run the setup.py install command
4
  try:
5
  subprocess.run(['python', 'setup.py', 'install', '--user'], check=True)
@@ -17,6 +17,7 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
17
  # Init TTS
18
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
19
 
 
20
  def voice_clone(text: str, speaker_wav: str, language: str):
21
  # Run TTS
22
  print("Speaker wav:", speaker_wav)
@@ -26,7 +27,7 @@ def voice_clone(text: str, speaker_wav: str, language: str):
26
  iface = gr.Interface(fn=voice_clone,
27
  inputs=[gr.Textbox(lines=2, placeholder="Enter the text...", label="Text"),
28
  gr.Audio(type="filepath", label="Upload audio file"),
29
- gr.Radio(['nl', 'en'], label="language"),
30
  ],
31
  outputs=gr.Audio(type="filepath", label="Generated audio file"),
32
  title="Voice Cloning")
 
1
  import subprocess
2
+ import spaces
3
  # Run the setup.py install command
4
  try:
5
  subprocess.run(['python', 'setup.py', 'install', '--user'], check=True)
 
17
  # Init TTS
18
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
19
 
20
+ @spaces.GPU
21
  def voice_clone(text: str, speaker_wav: str, language: str):
22
  # Run TTS
23
  print("Speaker wav:", speaker_wav)
 
27
  iface = gr.Interface(fn=voice_clone,
28
  inputs=[gr.Textbox(lines=2, placeholder="Enter the text...", label="Text"),
29
  gr.Audio(type="filepath", label="Upload audio file"),
30
+ gr.Radio(['nl', 'en', 'fr'], label="language"),
31
  ],
32
  outputs=gr.Audio(type="filepath", label="Generated audio file"),
33
  title="Voice Cloning")