Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import scipy
|
| 3 |
+
import gradio as gr
|
| 4 |
+
synthesiser = pipeline("text-to-audio", "facebook/musicgen-small")
|
| 5 |
+
def generate_music(Prompt):
|
| 6 |
+
music = synthesiser(Prompt, forward_params={"do_sample": True, "max_new_tokens":100})
|
| 7 |
+
rate = music["sampling_rate"]
|
| 8 |
+
mus = music["audio"][0].reshape(-1)
|
| 9 |
+
return rate,mus
|
| 10 |
+
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"])
|
| 11 |
+
inf.launch(share = True)
|