thecollabagepatch commited on
Commit
77e4f9e
·
1 Parent(s): 8a4f7ba

updated musicgen api handler

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -390,16 +390,16 @@ def extend_with_musicgen_api(audio_path, prompt_duration, musicgen_model, output
390
  client = Client("thepatch/micro-slot-machine")
391
 
392
  print(f"🎼 MusicGen extension:")
393
- print(f" Prompt duration: {prompt_duration}s")
394
  print(f" Model: {musicgen_model}")
395
- print(f" Output duration: {output_duration}s")
396
 
397
  # Call the continue_music API
398
  result = client.predict(
399
  input_audio_path=handle_file(audio_path),
400
- prompt_duration=str(prompt_duration),
401
  musicgen_model=musicgen_model,
402
- output_duration=output_duration,
403
  api_name="/continue_music"
404
  )
405
 
@@ -644,16 +644,16 @@ with gr.Blocks(title="stable-melodyflow") as iface:
644
  with gr.Column():
645
  musicgen_prompt_duration = gr.Dropdown(
646
  label="prompt duration (seconds)",
647
- choices=[3, 5, 7, 10],
648
- value=5,
649
  info="how much of the end to use as prompt for continuation"
650
  )
651
  musicgen_output_duration = gr.Slider(
652
  label="extension duration (seconds)",
653
- minimum=10,
654
- maximum=30,
655
- step=1,
656
- value=20,
657
  info="how much new audio to generate"
658
  )
659
 
@@ -662,10 +662,11 @@ with gr.Blocks(title="stable-melodyflow") as iface:
662
  label="musicgen model",
663
  choices=[
664
  "thepatch/vanya_ai_dnb_0.1 (small)",
665
- "thepatch/bleeps-medium (medium)"
 
666
  ],
667
  value="thepatch/vanya_ai_dnb_0.1 (small)",
668
- info="drum & bass focused vs experimental bleeps"
669
  )
670
 
671
  extend_btn = gr.Button("extend with musicgen", variant="primary", size="lg")
 
390
  client = Client("thepatch/micro-slot-machine")
391
 
392
  print(f"🎼 MusicGen extension:")
393
+ print(f" Prompt duration: {prompt_duration} (type: {type(prompt_duration)})")
394
  print(f" Model: {musicgen_model}")
395
+ print(f" Output duration: {output_duration} (type: {type(output_duration)})")
396
 
397
  # Call the continue_music API
398
  result = client.predict(
399
  input_audio_path=handle_file(audio_path),
400
+ prompt_duration=prompt_duration, # Already a string from dropdown
401
  musicgen_model=musicgen_model,
402
+ output_duration=float(output_duration), # Ensure it's a float
403
  api_name="/continue_music"
404
  )
405
 
 
644
  with gr.Column():
645
  musicgen_prompt_duration = gr.Dropdown(
646
  label="prompt duration (seconds)",
647
+ choices=["3", "5", "7", "10"], # Strings to match API requirements
648
+ value="5",
649
  info="how much of the end to use as prompt for continuation"
650
  )
651
  musicgen_output_duration = gr.Slider(
652
  label="extension duration (seconds)",
653
+ minimum=10.0,
654
+ maximum=30.0,
655
+ step=1.0,
656
+ value=20.0,
657
  info="how much new audio to generate"
658
  )
659
 
 
662
  label="musicgen model",
663
  choices=[
664
  "thepatch/vanya_ai_dnb_0.1 (small)",
665
+ "thepatch/bleeps-medium (medium)",
666
+ "thepatch/hoenn_lofi (large)"
667
  ],
668
  value="thepatch/vanya_ai_dnb_0.1 (small)",
669
+ info="various musicgen fine-tunes for different styles"
670
  )
671
 
672
  extend_btn = gr.Button("extend with musicgen", variant="primary", size="lg")