File size: 328 Bytes
caf2559
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import gc
from transformers import pipeline
from utils import spaces_gpu

@spaces_gpu
def text_to_speech(text: str) -> tuple[int, bytes]:
    narrator = pipeline("text-to-speech", "kakao-enterprise/vits-ljs")
    del narrator
    gc.collect()
    result = narrator(text)
    return (result["sampling_rate"], result["audio"][0])