zixian commited on
Commit
cc2afee
1 Parent(s): 37818c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -38,8 +38,8 @@ def create_tts_fn(model, hps, speaker_ids):
38
  x_tst = stn_tst.unsqueeze(0).to(device)
39
  x_tst_lengths = LongTensor([stn_tst.size(0)]).to(device)
40
 
41
- if stn_tst.size(0) >= 200:
42
- return "文本太长了!", (hps.data.sampling_rate, None)
43
  sid = LongTensor([speaker_id]).to(device)
44
  audio = model.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8,
45
  length_scale=1.0 / speed)[0][0, 0].data.cpu().float().numpy()
 
38
  x_tst = stn_tst.unsqueeze(0).to(device)
39
  x_tst_lengths = LongTensor([stn_tst.size(0)]).to(device)
40
 
41
+ if stn_tst.size(0) >= 500:
42
+ return "文本太长了!", (hps.data.sampling_rate, np.zeros(1000))
43
  sid = LongTensor([speaker_id]).to(device)
44
  audio = model.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8,
45
  length_scale=1.0 / speed)[0][0, 0].data.cpu().float().numpy()