Music_Generator / app.py
annapurnapadmaprema-ji's picture
Upload 2 files
8092c47 verified
raw
history blame
945 Bytes
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()