kdrkdrkdr commited on
Commit
1bb7b3a
1 Parent(s): 55abf8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -42,9 +42,9 @@ def create_tts_fn(model, hps, speaker_ids):
42
  speaker_id = speaker_ids[speaker]
43
  stn_tst = get_text(text, hps, is_phoneme)
44
  with no_grad():
45
- x_tst = stn_tst.unsqueeze(0)
46
- x_tst_lengths = LongTensor([stn_tst.size(0)])
47
- sid = LongTensor([speaker_id])
48
  audio = model.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8,
49
  length_scale=1.0 / speed)[0][0, 0].data.cpu().float().numpy()
50
  del stn_tst, x_tst, x_tst_lengths, sid
@@ -98,6 +98,7 @@ if __name__ == '__main__':
98
  n_speakers=hps.data.n_speakers,
99
  **hps.model)
100
  utils.load_checkpoint(model_path, model, None)
 
101
  model.eval()
102
  speaker_ids = [0]
103
  speakers = [name]
@@ -159,4 +160,4 @@ if __name__ == '__main__':
159
  return [];
160
  }}""")
161
 
162
- app.queue(concurrency_count=3).launch(show_api=False)
 
42
  speaker_id = speaker_ids[speaker]
43
  stn_tst = get_text(text, hps, is_phoneme)
44
  with no_grad():
45
+ x_tst = stn_tst.cuda().unsqueeze(0)
46
+ x_tst_lengths = LongTensor([stn_tst.size(0)]).cuda()
47
+ sid = LongTensor([speaker_id]).cuda()
48
  audio = model.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8,
49
  length_scale=1.0 / speed)[0][0, 0].data.cpu().float().numpy()
50
  del stn_tst, x_tst, x_tst_lengths, sid
 
98
  n_speakers=hps.data.n_speakers,
99
  **hps.model)
100
  utils.load_checkpoint(model_path, model, None)
101
+ model.cuda()
102
  model.eval()
103
  speaker_ids = [0]
104
  speakers = [name]
 
160
  return [];
161
  }}""")
162
 
163
+ app.queue(concurrency_count=10).launch(show_api=False)