thecollabagepatch commited on
Commit
4f864e1
·
1 Parent(s): 8ae81eb

tuple and str i guess

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -121,16 +121,17 @@ def generate_midi(seed, use_chords, chord_progression, bpm):
121
 
122
  @spaces.GPU(duration=120)
123
  def generate_music(midi_audio, prompt_duration, musicgen_model, num_iterations, bpm):
124
- audio_data, sample_rate = midi_audio
125
 
126
- # Convert the audio data to a PyTorch tensor
127
- song = torch.from_numpy(audio_data).to(device)
 
128
 
129
  # Use the user-provided BPM value for duration calculation
130
  duration = calculate_duration(bpm)
131
 
132
  # Create slices from the song using the user-provided BPM value
133
- slices = create_slices(song, sample_rate, 35, bpm, num_slices=5)
134
 
135
  # Load the model
136
  model_name = musicgen_model.split(" ")[0]
 
121
 
122
  @spaces.GPU(duration=120)
123
  def generate_music(midi_audio, prompt_duration, musicgen_model, num_iterations, bpm):
124
+ wav_filename, sample_rate = midi_audio
125
 
126
+ # Load the generated audio
127
+ song, sr = torchaudio.load(wav_filename)
128
+ song = song.to(device)
129
 
130
  # Use the user-provided BPM value for duration calculation
131
  duration = calculate_duration(bpm)
132
 
133
  # Create slices from the song using the user-provided BPM value
134
+ slices = create_slices(song, sr, 35, bpm, num_slices=5)
135
 
136
  # Load the model
137
  model_name = musicgen_model.split(" ")[0]