Gpagejr12 commited on
Commit
0f49a1d
·
verified ·
1 Parent(s): 57cdeb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -17,9 +17,11 @@ def load_model():
17
  return model
18
 
19
  def generate_music_tensors(descriptions, duration: int):
20
- # model = load_model()
21
- model = load_model().to('cpu')
22
 
 
 
 
23
 
24
  model.set_generation_params(
25
  use_sampling=True,
@@ -65,7 +67,7 @@ st.set_page_config(
65
 
66
  def main():
67
  with st.sidebar:
68
- st.header("""⚙️Generate Music ⚙️""",divider="rainbow")
69
  st.text("")
70
  st.subheader("1. Enter your music description.......")
71
  bpm = st.number_input("Enter Speed in BPM", min_value=60)
@@ -77,12 +79,12 @@ def main():
77
 
78
  st.subheader("2. Select time duration (In Seconds)")
79
  # time_slider = st.slider("Select time duration (In Seconds)", 0, 60, 10)
80
- time_slider = st.slider("Select time duration (In Minutes)", 0,300,10, step=1)
81
 
82
 
83
  st.title("""🎵 Song Lab AI 🎵""")
84
  st.text('')
85
- left_co,right_co = st.columns(2)
86
  left_co.write("""Music Generation through a prompt""")
87
  left_co.write(("""PS : First generation may take some time ......."""))
88
 
@@ -117,4 +119,3 @@ def main():
117
 
118
  if __name__ == "__main__":
119
  main()
120
-
 
17
  return model
18
 
19
  def generate_music_tensors(descriptions, duration: int):
20
+ model = load_model()
 
21
 
22
+ # Manually set the device to CPU
23
+ device = torch.device('cpu')
24
+ model = model.to(device)
25
 
26
  model.set_generation_params(
27
  use_sampling=True,
 
67
 
68
  def main():
69
  with st.sidebar:
70
+ st.header("""⚙️Generate Music ⚙️""", divider="rainbow")
71
  st.text("")
72
  st.subheader("1. Enter your music description.......")
73
  bpm = st.number_input("Enter Speed in BPM", min_value=60)
 
79
 
80
  st.subheader("2. Select time duration (In Seconds)")
81
  # time_slider = st.slider("Select time duration (In Seconds)", 0, 60, 10)
82
+ time_slider = st.slider("Select time duration (In Minutes)", 0, 300, 10, step=1)
83
 
84
 
85
  st.title("""🎵 Song Lab AI 🎵""")
86
  st.text('')
87
+ left_co, right_co = st.columns(2)
88
  left_co.write("""Music Generation through a prompt""")
89
  left_co.write(("""PS : First generation may take some time ......."""))
90
 
 
119
 
120
  if __name__ == "__main__":
121
  main()