lauraibnz commited on
Commit
29702ba
·
1 Parent(s): c065dde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -49,9 +49,11 @@ def synthesize(midi_file=None):
49
 
50
  def run_example(midi_file=None, prompt="", neg_prompt="", duration=None, seed=0, cond=1, inf=20, guidance_scale=2.5, guess=False):
51
  midi_synth = synthesize(midi_file)
52
- if duration == 0:
 
53
  duration = midi_synth[1].shape[0]/SAMPLE_RATE
54
- gen_audio = predict(midi_file, prompt, neg_prompt, duration, seed, cond, inf, guidance_scale, guess)
 
55
  return midi_synth, gen_audio
56
 
57
  with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.themes.sizes.text_md, font=[gr.themes.GoogleFont("Nunito Sans")])) as demo:
 
49
 
50
  def run_example(midi_file=None, prompt="", neg_prompt="", duration=None, seed=0, cond=1, inf=20, guidance_scale=2.5, guess=False):
51
  midi_synth = synthesize(midi_file)
52
+ if not duration or duration == 0:
53
+ print("Duration", duration)
54
  duration = midi_synth[1].shape[0]/SAMPLE_RATE
55
+ print("New duration", duration)
56
+ gen_audio = predict(midi_file, prompt, neg_prompt, duration=duration, seed, cond, inf, guidance_scale, guess)
57
  return midi_synth, gen_audio
58
 
59
  with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.themes.sizes.text_md, font=[gr.themes.GoogleFont("Nunito Sans")])) as demo: