thecollabagepatch commited on
Commit
95136bd
·
1 Parent(s): 85b6f84

no more duration params

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -18,8 +18,8 @@ def preprocess_audio(waveform):
18
  waveform_np = waveform.cpu().squeeze().numpy()
19
  return torch.from_numpy(waveform_np).unsqueeze(0).to(device)
20
 
21
- @spaces.GPU # Remove duration parameter
22
- def generate_drum_sample():
23
  model = MusicGen.get_pretrained('pharoAIsanders420/micro-musicgen-jungle')
24
  model.set_generation_params(duration=10)
25
  wav = model.generate_unconditional(1).squeeze(0)
@@ -31,7 +31,7 @@ def generate_drum_sample():
31
 
32
  return filename_with_extension
33
 
34
- @spaces.GPU # Remove duration parameter
35
  def continue_drum_sample(existing_audio_path):
36
  if existing_audio_path is None:
37
  return None
@@ -69,7 +69,7 @@ def continue_drum_sample(existing_audio_path):
69
 
70
  return combined_file_path
71
 
72
- @spaces.GPU # Remove duration parameter
73
  def generate_music(wav_filename, prompt_duration, musicgen_model, output_duration):
74
  if wav_filename is None:
75
  return None
@@ -104,7 +104,7 @@ def generate_music(wav_filename, prompt_duration, musicgen_model, output_duratio
104
 
105
  return filename_with_extension
106
 
107
- @spaces.GPU # Remove duration parameter
108
  def continue_music(input_audio_path, prompt_duration, musicgen_model, output_duration):
109
  if input_audio_path is None:
110
  return None
@@ -166,7 +166,7 @@ def continue_music(input_audio_path, prompt_duration, musicgen_model, output_dur
166
 
167
  return combined_audio_filename
168
 
169
- # Define the expandable sections
170
  musicgen_micro_blurb = """
171
  ## musicgen_micro
172
  musicgen micro is an experimental series of models by aaron abebe. they are incredibly fast, and extra insane. this one does goated jungle drums. we're very excited about these.
@@ -209,7 +209,7 @@ thepatch/PhonkV2 was trained by MJ BERSABEph. there are multiple versions in the
209
  foureyednymph/musicgen-sza-sos-small was just trained by foureyednymph. We're all about to find out if it does continuations well.
210
  """
211
 
212
- # Create the Gradio interface
213
  with gr.Blocks() as iface:
214
  gr.Markdown("# the-micro-slot-machine")
215
  gr.Markdown("two ai's jamming. warning: outputs will be very strange, likely stupid, and possibly rad.")
 
18
  waveform_np = waveform.cpu().squeeze().numpy()
19
  return torch.from_numpy(waveform_np).unsqueeze(0).to(device)
20
 
21
+ @spaces.GPU(duration=10)
22
+ def generate_drum_sample() -> str:
23
  model = MusicGen.get_pretrained('pharoAIsanders420/micro-musicgen-jungle')
24
  model.set_generation_params(duration=10)
25
  wav = model.generate_unconditional(1).squeeze(0)
 
31
 
32
  return filename_with_extension
33
 
34
+ @spaces.GPU(duration=10)
35
  def continue_drum_sample(existing_audio_path):
36
  if existing_audio_path is None:
37
  return None
 
69
 
70
  return combined_file_path
71
 
72
+ @spaces.GPU(duration=120)
73
  def generate_music(wav_filename, prompt_duration, musicgen_model, output_duration):
74
  if wav_filename is None:
75
  return None
 
104
 
105
  return filename_with_extension
106
 
107
+ @spaces.GPU(duration=120)
108
  def continue_music(input_audio_path, prompt_duration, musicgen_model, output_duration):
109
  if input_audio_path is None:
110
  return None
 
166
 
167
  return combined_audio_filename
168
 
169
+ # Define the expandable sections (keeping your existing content)
170
  musicgen_micro_blurb = """
171
  ## musicgen_micro
172
  musicgen micro is an experimental series of models by aaron abebe. they are incredibly fast, and extra insane. this one does goated jungle drums. we're very excited about these.
 
209
  foureyednymph/musicgen-sza-sos-small was just trained by foureyednymph. We're all about to find out if it does continuations well.
210
  """
211
 
212
+ # Create the Gradio interface with explicit types
213
  with gr.Blocks() as iface:
214
  gr.Markdown("# the-micro-slot-machine")
215
  gr.Markdown("two ai's jamming. warning: outputs will be very strange, likely stupid, and possibly rad.")