Spaces:
Sleeping
Sleeping
thecollabagepatch
commited on
Commit
·
bd9caa9
1
Parent(s):
90d8e0f
sobadatthis
Browse files
app.py
CHANGED
@@ -121,11 +121,11 @@ def generate_midi(seed, use_chords, chord_progression, bpm):
|
|
121 |
return (wav_filename, sample_rate)
|
122 |
|
123 |
@spaces.GPU(duration=120)
|
124 |
-
def generate_music(
|
125 |
-
|
126 |
-
|
|
|
127 |
song = song.to(device)
|
128 |
-
|
129 |
# Use the user-provided BPM value for duration calculation
|
130 |
duration = calculate_duration(bpm)
|
131 |
|
@@ -242,7 +242,7 @@ with gr.Blocks() as iface:
|
|
242 |
|
243 |
midi_result = gr.Variable()
|
244 |
|
245 |
-
generate_midi_button.click(generate_midi, inputs=[seed, use_chords, chord_progression, bpm], outputs=
|
246 |
-
generate_music_button.click(generate_music, inputs=[
|
247 |
|
248 |
iface.launch()
|
|
|
121 |
return (wav_filename, sample_rate)
|
122 |
|
123 |
@spaces.GPU(duration=120)
|
124 |
+
def generate_music(midi_audio_info, prompt_duration, musicgen_model, num_iterations, bpm):
|
125 |
+
wav_filename, sample_rate = midi_audio_info
|
126 |
+
# Correctly use wav_filename to load the audio
|
127 |
+
song, sr = torchaudio.load(wav_filename)
|
128 |
song = song.to(device)
|
|
|
129 |
# Use the user-provided BPM value for duration calculation
|
130 |
duration = calculate_duration(bpm)
|
131 |
|
|
|
242 |
|
243 |
midi_result = gr.Variable()
|
244 |
|
245 |
+
generate_midi_button.click(generate_midi, inputs=[seed, use_chords, chord_progression, bpm], outputs=[midi_audio])
|
246 |
+
generate_music_button.click(generate_music, inputs=[midi_audio, prompt_duration, musicgen_model, num_iterations, bpm], outputs=output_audio)
|
247 |
|
248 |
iface.launch()
|