File size: 945 Bytes
8092c47 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
from audiocraft.models import MusicGen
import streamlit as st
import os
import torch
import torchaudio
import numpy as np
import base64
@st.cache_resource
def load_model():
model=MusicGen.get_pretrained("facebook/musicgen-small")
return model
st.set_page_config(
page_icon=":musical_note:",
page_title="Music Gen"
)
def main():
st.title("Your Music")
with st.expander("See Explanation"):
st.write("App is developed by using Meta's Audiocraft Music Gen model. Write your text and we will generate audio")
text_area=st.text_area("Enter description")
time_slider=st.slider("Select time duration(s)",2,5,20)
if text_area and time_slider:
st.json(
{
"Description":text_area,
"Selected duration:":time_slider
}
)
st.subheader("Generated Music")
if __name__=="__main__":
main() |