asigalov61 commited on
Commit
0a38635
1 Parent(s): 79734dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -307,6 +307,8 @@ def Generate_Chords(input_midi, input_num_prime_chords, input_num_gen_chords):
307
  with ctx:
308
  out = model.generate(x,
309
  1,
 
 
310
  temperature=0.9,
311
  return_prime=False,
312
  verbose=False)
@@ -449,7 +451,7 @@ if __name__ == "__main__":
449
  gr.Markdown("## Upload your MIDI or select a sample example MIDI")
450
 
451
  input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
452
- input_num_prime_chords = gr.Slider(1, 128, value=1, step=1, label="Number of prime chords")
453
  input_num_gen_chords = gr.Slider(4, 256, value=128, step=1, label="Number of composition chords to generate progression for")
454
 
455
  run_btn = gr.Button("Generate Chords", variant="primary")
@@ -466,13 +468,12 @@ if __name__ == "__main__":
466
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
467
 
468
  gr.Examples(
469
- [["Chords-Progressions-Transformer-Piano-Seed-2.mid", 1, 128],
470
- ["Chords-Progressions-Transformer-MI-Seed-1.mid", 16, 128],
471
- ["Chords-Progressions-Transformer-MI-Seed-2.mid", 1, 128],
472
- ["Chords-Progressions-Transformer-MI-Seed-3.mid", 16, 128],
473
- ["Chords-Progressions-Transformer-MI-Seed-4.mid", 1, 128],
474
- ["Chords-Progressions-Transformer-MI-Seed-5.mid", 16, 128],
475
- ["Chords-Progressions-Transformer-MI-Seed-6.mid", 1, 128]
476
  ],
477
  [input_midi, input_num_prime_chords, input_num_gen_chords],
478
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
 
307
  with ctx:
308
  out = model.generate(x,
309
  1,
310
+ filter_logits_fn=top_p,
311
+ filter_kwargs={'thres': 0.96},
312
  temperature=0.9,
313
  return_prime=False,
314
  verbose=False)
 
451
  gr.Markdown("## Upload your MIDI or select a sample example MIDI")
452
 
453
  input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
454
+ input_num_prime_chords = gr.Slider(1, 128, value=32, step=1, label="Number of prime chords")
455
  input_num_gen_chords = gr.Slider(4, 256, value=128, step=1, label="Number of composition chords to generate progression for")
456
 
457
  run_btn = gr.Button("Generate Chords", variant="primary")
 
468
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
469
 
470
  gr.Examples(
471
+ [["Chords-Progressions-Transformer-MI-Seed-1.mid", 32, 128],
472
+ ["Chords-Progressions-Transformer-MI-Seed-2.mid", 32, 128],
473
+ ["Chords-Progressions-Transformer-MI-Seed-3.mid", 32, 128],
474
+ ["Chords-Progressions-Transformer-MI-Seed-4.mid", 32, 128],
475
+ ["Chords-Progressions-Transformer-MI-Seed-5.mid", 32, 128],
476
+ ["Chords-Progressions-Transformer-MI-Seed-6.mid", 32, 128]
 
477
  ],
478
  [input_midi, input_num_prime_chords, input_num_gen_chords],
479
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],