Respair commited on
Commit
6729e8e
1 Parent(s): 54de0ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -1
app.py CHANGED
@@ -36,6 +36,7 @@ theme = gr.themes.Base(
36
  font=[gr.themes.GoogleFont('Libre Franklin'), gr.themes.GoogleFont('Public Sans'), 'system-ui', 'sans-serif'],
37
  )
38
 
 
39
 
40
  voicelist = ['VO_JA_Kamisato_Ayaka_About_Kujou_Sara','hontonokimochi','gaen_original']
41
  voices = {}
@@ -89,7 +90,22 @@ def synthesize(text, voice, lngsteps, password, progress=gr.Progress()):
89
  # return (24000, np.concatenate(audios))
90
  # else:
91
  # raise gr.Error('Wrong access code')
 
92
  def clsynthesize(text, voice, vcsteps, embscale, alpha, beta, progress=gr.Progress()):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  # if text.strip() == "":
94
  # raise gr.Error("You must enter some text")
95
  # # if global_phonemizer.phonemize([text]) > 300:
@@ -120,12 +136,28 @@ def clsynthesize(text, voice, vcsteps, embscale, alpha, beta, progress=gr.Progre
120
 
121
 
122
  def ljsynthesize(text, steps,embscale, progress=gr.Progress()):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  # if text.strip() == "":
124
  # raise gr.Error("You must enter some text")
125
  # # if global_phonemizer.phonemize([text]) > 300:
126
  # if len(text) > 400:
127
  # raise gr.Error("Text must be under 400 characters")
128
- noise = torch.randn(1,1,256).to('cuda' if torch.cuda.is_available() else 'cpu')
129
  # return (24000, Text-guided Inferenceimportable.inference(text, noise, diffusion_steps=7, embedding_scale=1))
130
  if text.strip() == "":
131
  raise gr.Error("You must enter some text")
 
36
  font=[gr.themes.GoogleFont('Libre Franklin'), gr.themes.GoogleFont('Public Sans'), 'system-ui', 'sans-serif'],
37
  )
38
 
39
+ from Modules.diffusion.sampler import DiffusionSampler, ADPM2Sampler, KarrasSchedule
40
 
41
  voicelist = ['VO_JA_Kamisato_Ayaka_About_Kujou_Sara','hontonokimochi','gaen_original']
42
  voices = {}
 
90
  # return (24000, np.concatenate(audios))
91
  # else:
92
  # raise gr.Error('Wrong access code')
93
+
94
  def clsynthesize(text, voice, vcsteps, embscale, alpha, beta, progress=gr.Progress()):
95
+
96
+
97
+ torch.manual_seed(0)
98
+ torch.backends.cudnn.benchmark = False
99
+ torch.backends.cudnn.deterministic = True
100
+
101
+
102
+ random.seed(0)
103
+
104
+ sampler = DiffusionSampler(
105
+ model.diffusion.diffusion,
106
+ sampler=ADPM2Sampler(),
107
+ sigma_schedule=KarrasSchedule(sigma_min=0.0001, sigma_max=0.75, rho=4.), # empirical parameters
108
+ clamp=False)
109
  # if text.strip() == "":
110
  # raise gr.Error("You must enter some text")
111
  # # if global_phonemizer.phonemize([text]) > 300:
 
136
 
137
 
138
  def ljsynthesize(text, steps,embscale, progress=gr.Progress()):
139
+
140
+
141
+
142
+ torch.manual_seed(0)
143
+ torch.backends.cudnn.benchmark = False
144
+ torch.backends.cudnn.deterministic = True
145
+
146
+
147
+ random.seed(0)
148
+
149
+ sampler = DiffusionSampler(
150
+ model.diffusion.diffusion,
151
+ sampler=ADPM2Sampler(),
152
+ sigma_schedule=KarrasSchedule(sigma_min=0.0001, sigma_max=0.75, rho=4.), # empirical parameters
153
+ clamp=False)
154
+
155
  # if text.strip() == "":
156
  # raise gr.Error("You must enter some text")
157
  # # if global_phonemizer.phonemize([text]) > 300:
158
  # if len(text) > 400:
159
  # raise gr.Error("Text must be under 400 characters")
160
+ noise = torch.tanh(torch.randn(1,1,256).to('cuda' if torch.cuda.is_available() else 'cpu'))
161
  # return (24000, Text-guided Inferenceimportable.inference(text, noise, diffusion_steps=7, embedding_scale=1))
162
  if text.strip() == "":
163
  raise gr.Error("You must enter some text")