Spaces:
Runtime error
Runtime error
File size: 717 Bytes
ad9d5f9 d00d71c ad9d5f9 f395d3e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from transformers import pipeline
import scipy
import gradio as gr
synthesiser = pipeline("text-to-audio", "facebook/musicgen-small")
def generate_music(Prompt):
music = synthesiser(Prompt, forward_params={"do_sample": True, "max_new_tokens":100})
# scipy.io.wavfile.write("musicgen_out2.wav", rate=music["sampling_rate"], data=music["audio"])
rate = music["sampling_rate"]
mus = music["audio"][0].reshape(-1)
return rate,mus
inf = gr.Interface(generate_music,title = "Mashdemy Demo Music Generator App", description = "Type in the kind of music you prefer and click submit", inputs =["text"], outputs=["audio"], examples = ["lo-fi music with a soothing melody", "pop music"])
inf.launch(share = True) |