annapurnapadmaprema-ji commited on
Commit
8092c47
1 Parent(s): b405756

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +37 -0
  2. requirements.txt +28 -0
app.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from audiocraft.models import MusicGen
2
+ import streamlit as st
3
+ import os
4
+ import torch
5
+ import torchaudio
6
+ import numpy as np
7
+ import base64
8
+
9
+ @st.cache_resource
10
+ def load_model():
11
+ model=MusicGen.get_pretrained("facebook/musicgen-small")
12
+ return model
13
+
14
+ st.set_page_config(
15
+ page_icon=":musical_note:",
16
+ page_title="Music Gen"
17
+ )
18
+
19
+ def main():
20
+ st.title("Your Music")
21
+
22
+ with st.expander("See Explanation"):
23
+ st.write("App is developed by using Meta's Audiocraft Music Gen model. Write your text and we will generate audio")
24
+ text_area=st.text_area("Enter description")
25
+ time_slider=st.slider("Select time duration(s)",2,5,20)
26
+
27
+ if text_area and time_slider:
28
+ st.json(
29
+ {
30
+ "Description":text_area,
31
+ "Selected duration:":time_slider
32
+ }
33
+ )
34
+ st.subheader("Generated Music")
35
+
36
+ if __name__=="__main__":
37
+ main()
requirements.txt ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # please make sure you have already a pytorch install that is cuda enabled!
2
+ av==11.0.0
3
+ einops
4
+ flashy>=0.0.1
5
+ hydra-core>=1.1
6
+ hydra_colorlog
7
+ julius
8
+ num2words
9
+ numpy<2.0.0
10
+ sentencepiece
11
+ spacy==3.7.6
12
+ torch==2.1.0
13
+ torchaudio>=2.0.0,<2.1.2
14
+ huggingface_hub
15
+ tqdm
16
+ transformers>=4.31.0 # need Encodec there.
17
+ xformers<0.0.23
18
+ demucs
19
+ librosa
20
+ soundfile
21
+ gradio
22
+ torchmetrics
23
+ encodec
24
+ protobuf
25
+ torchvision==0.16.0
26
+ torchtext==0.16.0
27
+ pesq
28
+ pystoi