SAD43W commited on
Commit
63d761e
·
verified ·
1 Parent(s): 8f537fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,19 +1,18 @@
1
  from TTS.api import TTS
2
  import gradio as gr
3
- import os
4
 
5
- tts = TTS(model_name="coqui/XTTS-v2", gpu=True)
 
6
 
7
  def synthesize(text, speaker_wav):
8
  output_path = "output.wav"
9
  if speaker_wav is None:
10
  return "No voice sample uploaded.", None
11
 
12
- # Save uploaded file
13
  speaker_path = "temp_speaker.wav"
14
  speaker_wav.save(speaker_path)
15
 
16
- # Run TTS
17
  tts.tts_to_file(
18
  text=text,
19
  speaker_wav=speaker_path,
 
1
  from TTS.api import TTS
2
  import gradio as gr
3
+ import torch
4
 
5
+ tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2")
6
+ tts.to("cuda" if torch.cuda.is_available() else "cpu")
7
 
8
  def synthesize(text, speaker_wav):
9
  output_path = "output.wav"
10
  if speaker_wav is None:
11
  return "No voice sample uploaded.", None
12
 
 
13
  speaker_path = "temp_speaker.wav"
14
  speaker_wav.save(speaker_path)
15
 
 
16
  tts.tts_to_file(
17
  text=text,
18
  speaker_wav=speaker_path,