Pendrokar commited on
Commit
6930378
·
verified ·
1 Parent(s): 9ccc704
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -12,9 +12,10 @@ Is there a long queue on this space? Duplicate it and add a more powerful GPU to
12
 
13
  **NOTE: StyleTTS 2 is _currently_ English-only. Join the Discord for updates on multilingual training.**
14
  """
 
15
  import gradio as gr
16
  import styletts2importable
17
- import ljspeechimportable
18
  import torch
19
  import os
20
  from txtsplit import txtsplit
@@ -44,6 +45,8 @@ for v in voicelist:
44
  # # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=7, embedding_scale=1))
45
  # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=multispeakersteps, embedding_scale=1))
46
  if not torch.cuda.is_available(): INTROTXT += "\n\n### You are on a CPU-only system, inference will be much slower.\n\nYou can use the [online demo](https://huggingface.co/spaces/styletts2/styletts2) for fast inference."
 
 
47
  def synthesize(text, voice, lngsteps, password, progress=gr.Progress()):
48
  if text.strip() == "":
49
  raise gr.Error("You must enter some text")
@@ -75,6 +78,8 @@ def synthesize(text, voice, lngsteps, password, progress=gr.Progress()):
75
  # return (24000, np.concatenate(audios))
76
  # else:
77
  # raise gr.Error('Wrong access code')
 
 
78
  def clsynthesize(text, voice, vcsteps, embscale, alpha, beta, progress=gr.Progress()):
79
  # if text.strip() == "":
80
  # raise gr.Error("You must enter some text")
@@ -101,6 +106,8 @@ def clsynthesize(text, voice, vcsteps, embscale, alpha, beta, progress=gr.Progre
101
  audios.append(styletts2importable.inference(t, vs, alpha=alpha, beta=beta, diffusion_steps=vcsteps, embedding_scale=embscale))
102
  # audios.append(styletts2importable.inference(t, vs, diffusion_steps=10, alpha=0.3, beta=0.7, embedding_scale=5))
103
  return (24000, np.concatenate(audios))
 
 
104
  def ljsynthesize(text, steps, progress=gr.Progress()):
105
  # if text.strip() == "":
106
  # raise gr.Error("You must enter some text")
 
12
 
13
  **NOTE: StyleTTS 2 is _currently_ English-only. Join the Discord for updates on multilingual training.**
14
  """
15
+ import spaces
16
  import gradio as gr
17
  import styletts2importable
18
+ #import ljspeechimportable
19
  import torch
20
  import os
21
  from txtsplit import txtsplit
 
45
  # # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=7, embedding_scale=1))
46
  # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=multispeakersteps, embedding_scale=1))
47
  if not torch.cuda.is_available(): INTROTXT += "\n\n### You are on a CPU-only system, inference will be much slower.\n\nYou can use the [online demo](https://huggingface.co/spaces/styletts2/styletts2) for fast inference."
48
+
49
+ @spaces.GPU
50
  def synthesize(text, voice, lngsteps, password, progress=gr.Progress()):
51
  if text.strip() == "":
52
  raise gr.Error("You must enter some text")
 
78
  # return (24000, np.concatenate(audios))
79
  # else:
80
  # raise gr.Error('Wrong access code')
81
+
82
+ @spaces.GPU
83
  def clsynthesize(text, voice, vcsteps, embscale, alpha, beta, progress=gr.Progress()):
84
  # if text.strip() == "":
85
  # raise gr.Error("You must enter some text")
 
106
  audios.append(styletts2importable.inference(t, vs, alpha=alpha, beta=beta, diffusion_steps=vcsteps, embedding_scale=embscale))
107
  # audios.append(styletts2importable.inference(t, vs, diffusion_steps=10, alpha=0.3, beta=0.7, embedding_scale=5))
108
  return (24000, np.concatenate(audios))
109
+
110
+ @spaces.GPU
111
  def ljsynthesize(text, steps, progress=gr.Progress()):
112
  # if text.strip() == "":
113
  # raise gr.Error("You must enter some text")