Spaces:
Sleeping
Sleeping
File size: 469 Bytes
9ef2a14 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# external imports
from transformers import pipeline
import scipy
# local imports
import config
class Musicgen_Small:
def __init__(self):
self.local_pipeline = pipeline("text-to-audio", model=config.MUSICGEN_MODEL)
def generate_music_local_pipeline(self, prompt):
music = self.local_pipeline(prompt, forward_params={"do_sample": True})
scipy.io.wavfile.write("data/musicgen_out.wav", rate=music["sampling_rate"], data=music["audio"])
|