Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
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
|
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['
|
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)
|