Korakoe commited on
Commit
d69ad4e
1 Parent(s): 07d01ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -65,6 +65,7 @@ for v in voicelist:
65
  # # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=7, embedding_scale=1))
66
  # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=multispeakersteps, embedding_scale=1))
67
  if not torch.cuda.is_available(): INTROTXT += "\n\n### on CPU, it'll run rather slower, but not too much."
 
68
  @spaces.GPU
69
  def synthesize(text, voice, lngsteps,embscale,alpha, beta, password, progress=gr.Progress()):
70
  if text.strip() == "":
@@ -79,7 +80,7 @@ def synthesize(text, voice, lngsteps,embscale,alpha, beta, password, progress=gr
79
  audios = []
80
  for t in progress.tqdm(texts):
81
  print(t)
82
- audios.append(styletts2importable.inference(t, voices[v], alpha=alpha, beta=beta, diffusion_steps=lngsteps, embedding_scale=embscale))
83
  return (24000, np.concatenate(audios))
84
  # def longsynthesize(text, voice, lngsteps, password, progress=gr.Progress()):
85
  # if password == os.environ['ACCESS_CODE']:
@@ -97,7 +98,8 @@ def synthesize(text, voice, lngsteps,embscale,alpha, beta, password, progress=gr
97
  # return (24000, np.concatenate(audios))
98
  # else:
99
  # raise gr.Error('Wrong access code')
100
-
 
101
  def clsynthesize(text, voice, vcsteps, embscale, alpha, beta, progress=gr.Progress()):
102
 
103
 
 
65
  # # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=7, embedding_scale=1))
66
  # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=multispeakersteps, embedding_scale=1))
67
  if not torch.cuda.is_available(): INTROTXT += "\n\n### on CPU, it'll run rather slower, but not too much."
68
+ if not torch.cuda.is_available(): device = "cpu" else "cuda"
69
  @spaces.GPU
70
  def synthesize(text, voice, lngsteps,embscale,alpha, beta, password, progress=gr.Progress()):
71
  if text.strip() == "":
 
80
  audios = []
81
  for t in progress.tqdm(texts):
82
  print(t)
83
+ audios.append(styletts2importable.inference(t, voices[v].to(device), alpha=alpha, beta=beta, diffusion_steps=lngsteps, embedding_scale=embscale))
84
  return (24000, np.concatenate(audios))
85
  # def longsynthesize(text, voice, lngsteps, password, progress=gr.Progress()):
86
  # if password == os.environ['ACCESS_CODE']:
 
98
  # return (24000, np.concatenate(audios))
99
  # else:
100
  # raise gr.Error('Wrong access code')
101
+
102
+ @spaces.GPU
103
  def clsynthesize(text, voice, vcsteps, embscale, alpha, beta, progress=gr.Progress()):
104
 
105