Gpagejr12 commited on
Commit
0adf099
·
verified ·
1 Parent(s): 726e151

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -91,30 +91,30 @@ def main():
91
  left_co.write(("""PS : First generation may take some time ......."""))
92
 
93
  if st.sidebar.button('Generate !'):
94
- with left_co:
95
- st.text('')
96
- st.text('')
97
- st.text('')
98
- st.text('')
99
- st.text('')
100
- st.text('')
101
- st.subheader("Generated Music")
102
-
103
- # Generate audio
104
- descriptions = [f"{text_area} {selected_genre} {bpm} BPM" for _ in range(5)] # Adjust the batch size (5 in this case)
105
- music_tensors = generate_music_tensors(descriptions, time_slider)
106
-
107
- # Only play the full audio for index 0
108
- idx = 0
109
- music_tensor = music_tensors[idx]
110
- save_music_file = save_audio(music_tensor)
111
- audio_filepath = f'audio_output/audio_{idx}.wav'
112
- audio_file = open(audio_filepath, 'rb')
113
- audio_bytes = audio_file.read()
114
-
115
- # Play the full audio
116
- st.audio(audio_bytes, format='audio/wav')
117
- st.markdown(get_binary_file_downloader_html(audio_filepath, f'Audio_{idx}'), unsafe_allow_html=True)
118
 
119
 
120
  if __name__ == "__main__":
 
91
  left_co.write(("""PS : First generation may take some time ......."""))
92
 
93
  if st.sidebar.button('Generate !'):
94
+ with left_co:
95
+ st.text('')
96
+ st.text('')
97
+ st.text('')
98
+ st.text('')
99
+ st.text('')
100
+ st.text('')
101
+ st.subheader("Generated Music")
102
+
103
+ # Generate audio
104
+ descriptions = [f"{text_area} {selected_genre} {bpm} BPM" for _ in range(5)] # Adjust the batch size (5 in this case)
105
+ music_tensors = generate_music_tensors(descriptions, time_slider)
106
+
107
+ # Only play the full audio for index 0
108
+ idx = 0
109
+ music_tensor = music_tensors[idx]
110
+ save_music_file = save_audio(music_tensor)
111
+ audio_filepath = f'audio_output/audio_{idx}.wav'
112
+ audio_file = open(audio_filepath, 'rb')
113
+ audio_bytes = audio_file.read()
114
+
115
+ # Play the full audio
116
+ st.audio(audio_bytes, format='audio/wav')
117
+ st.markdown(get_binary_file_downloader_html(audio_filepath, f'Audio_{idx}'), unsafe_allow_html=True)
118
 
119
 
120
  if __name__ == "__main__":