Spaces:
Runtime error
Runtime error
fix bug when text is too large
Browse files
app.py
CHANGED
@@ -29,9 +29,10 @@ def translate(audio):
|
|
29 |
|
30 |
def synthesise(text):
|
31 |
inputs = processor(text=text, return_tensors="pt")
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
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 |
|