13 lines
396 B
Python
13 lines
396 B
Python
from transformers import pipeline
|
|
import scipy
|
|
|
|
|
|
class T2A(object):
|
|
def __init__(self):
|
|
self.synthesiser = pipeline("text-to-speech", "suno/bark")
|
|
|
|
def apply(self, text):
|
|
speech = self.synthesiser(text,
|
|
forward_params={"do_sample": True})
|
|
scipy.io.wavfile.write("bark_out.wav", rate=speech["sampling_rate"], data=speech["audio"])
|