Spaces:
Runtime error
Runtime error
NotProwler
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import
|
3 |
-
import torchaudio
|
4 |
from audiocraft.models import MusicGen
|
5 |
-
from audiocraft.data.audio import audio_write
|
6 |
|
7 |
@st.cache_resource
|
8 |
def load_musicgen_model():
|
9 |
-
model = MusicGen.get_pretrained(
|
10 |
model.set_generation_params(duration=10)
|
11 |
return model
|
12 |
|
@@ -27,8 +25,6 @@ if st.button("Generate Song"):
|
|
27 |
|
28 |
audio_output = model.generate([description])
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
st.audio("generated_song.wav", format="audio/wav")
|
33 |
|
34 |
st.write("Enjoy your personalized music experience! 🎼")
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import AutoProcessor, AutoModelForCausalLM
|
|
|
3 |
from audiocraft.models import MusicGen
|
|
|
4 |
|
5 |
@st.cache_resource
|
6 |
def load_musicgen_model():
|
7 |
+
model = MusicGen.get_pretrained("facebook/musicgen-large")
|
8 |
model.set_generation_params(duration=10)
|
9 |
return model
|
10 |
|
|
|
25 |
|
26 |
audio_output = model.generate([description])
|
27 |
|
28 |
+
st.audio(audio_output[0].cpu().detach().numpy(), format="audio/wav")
|
|
|
|
|
29 |
|
30 |
st.write("Enjoy your personalized music experience! 🎼")
|