Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -40,9 +40,9 @@ def create_tts_fn(model, hps, speaker_ids):
|
|
40 |
speaker_id = speaker_ids[speaker]
|
41 |
stn_tst = get_text(text, hps, is_phoneme)
|
42 |
with no_grad():
|
43 |
-
x_tst = stn_tst.unsqueeze(0)
|
44 |
-
x_tst_lengths = LongTensor([stn_tst.size(0)])
|
45 |
-
sid = LongTensor([speaker_id])
|
46 |
audio = model.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8,
|
47 |
length_scale=1.0 / speed)[0][0, 0].data.cpu().float().numpy()
|
48 |
del stn_tst, x_tst, x_tst_lengths, sid
|
@@ -96,7 +96,7 @@ if __name__ == '__main__':
|
|
96 |
hps.data.filter_length // 2 + 1,
|
97 |
hps.train.segment_size // hps.data.hop_length,
|
98 |
n_speakers=hps.data.n_speakers,
|
99 |
-
**hps.model)
|
100 |
utils.load_checkpoint(model_path, model, None)
|
101 |
model.eval()
|
102 |
speaker_ids = [sid for sid, name in enumerate(hps.speakers) if name != "None"]
|
|
|
40 |
speaker_id = speaker_ids[speaker]
|
41 |
stn_tst = get_text(text, hps, is_phoneme)
|
42 |
with no_grad():
|
43 |
+
x_tst = stn_tst.cuda().unsqueeze(0)
|
44 |
+
x_tst_lengths = LongTensor([stn_tst.size(0)]).cuda()
|
45 |
+
sid = LongTensor([speaker_id]).cuda()
|
46 |
audio = model.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8,
|
47 |
length_scale=1.0 / speed)[0][0, 0].data.cpu().float().numpy()
|
48 |
del stn_tst, x_tst, x_tst_lengths, sid
|
|
|
96 |
hps.data.filter_length // 2 + 1,
|
97 |
hps.train.segment_size // hps.data.hop_length,
|
98 |
n_speakers=hps.data.n_speakers,
|
99 |
+
**hps.model).cuda()
|
100 |
utils.load_checkpoint(model_path, model, None)
|
101 |
model.eval()
|
102 |
speaker_ids = [sid for sid, name in enumerate(hps.speakers) if name != "None"]
|