DanGalt commited on
Commit
911acef
·
1 Parent(s): cbb24fb

fix bug when text is too large

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -29,9 +29,10 @@ def translate(audio):
29
 
30
  def synthesise(text):
31
  inputs = processor(text=text, return_tensors="pt")
32
- if inputs.shape[0] > 600:
33
- inputs = inputs[:600]
34
- speech = model.generate_speech(inputs["input_ids"].to(device), speaker_embeddings.to(device), vocoder=vocoder)
 
35
  return speech.cpu()
36
 
37
 
 
29
 
30
  def synthesise(text):
31
  inputs = processor(text=text, return_tensors="pt")
32
+ input_ids = inputs["input_ids"]
33
+ if input_ids.shape[1] > 600:
34
+ input_ids = input_ids[0:1, :600]
35
+ speech = model.generate_speech(input_ids.to(device), speaker_embeddings.to(device), vocoder=vocoder)
36
  return speech.cpu()
37
 
38