hexgrad commited on
Commit
bb3b6bc
·
verified ·
1 Parent(s): 1a55ad7

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -233,7 +233,7 @@ SAMPLE_RATE = 24000
233
 
234
  @torch.no_grad()
235
  def forward(tokens, voices, speed, sk, device='cpu'):
236
- assert sk == os.environ['SK'], sk
237
  ref_s = torch.mean(torch.stack([VOICES[device][v][len(tokens)] for v in voices]), dim=0)
238
  tokens = torch.LongTensor([[0, *tokens, 0]]).to(device)
239
  input_lengths = torch.LongTensor([tokens.shape[-1]]).to(device)
@@ -292,7 +292,7 @@ def generate(text, voice='af', ps=None, speed=1, trim=0.5, use_gpu='auto', sk=No
292
  ps = ps or phonemize(text, voice)
293
  if sk not in {os.environ['SK'], os.environ['ARENA']}:
294
  assert text in sents or ps.strip('"') in harvsents, ('❌', datetime.now(), text, voice, use_gpu, sk)
295
- sk = os.environ['SK']
296
  voices = resolve_voices(voice, warn=ps)
297
  speed = clamp_speed(speed)
298
  trim = clamp_trim(trim)
 
233
 
234
  @torch.no_grad()
235
  def forward(tokens, voices, speed, sk, device='cpu'):
236
+ assert sk in {os.environ['SK'], os.environ['ARENA']}, sk
237
  ref_s = torch.mean(torch.stack([VOICES[device][v][len(tokens)] for v in voices]), dim=0)
238
  tokens = torch.LongTensor([[0, *tokens, 0]]).to(device)
239
  input_lengths = torch.LongTensor([tokens.shape[-1]]).to(device)
 
292
  ps = ps or phonemize(text, voice)
293
  if sk not in {os.environ['SK'], os.environ['ARENA']}:
294
  assert text in sents or ps.strip('"') in harvsents, ('❌', datetime.now(), text, voice, use_gpu, sk)
295
+ sk = os.environ['ARENA']
296
  voices = resolve_voices(voice, warn=ps)
297
  speed = clamp_speed(speed)
298
  trim = clamp_trim(trim)