asigalov61 commited on
Commit
e876f9c
·
verified ·
1 Parent(s): 3524423

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -37
app.py CHANGED
@@ -312,23 +312,21 @@ if __name__ == "__main__":
312
  "Check out [Tegridy MIDI Dataset](https://github.com/asigalov61/Tegridy-MIDI-Dataset) on GitHub!\n\n"
313
  )
314
 
315
- gr.Markdown("## Upload your MIDI or select a sample example MIDI below")
316
 
317
- input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
 
 
 
 
318
 
319
- gr.Markdown("## Select mixing options")
320
-
321
- input_find_best_match = gr.Checkbox(label="Find best match", value=False)
322
- input_adjust_melody_notes_durations = gr.Checkbox(label="Adjust melody notes durations", value=False)
323
- input_adjust_accompaniment_notes_durations = gr.Checkbox(label="Adjust accompaniment notes durations", value=False)
324
- input_output_as_solo_piano = gr.Checkbox(label="Output as Solo Piano", value=False)
325
- input_remove_drums = gr.Checkbox(label="Remove drums from output", value=False)
326
- input_output_tempo = gr.Radio(["Mix Melody", "Source Melody", "Mix"], value="Mix Melody", label="Output tempo")
327
- input_transform = gr.Radio(["As-is", "Flip Melody", "Reverse Melody", "Flip Mix", "Reverse Mix"], value="As-is", label="Transform")
328
- input_transpose_value = gr.Slider(-12, 12, value=0, step=1, label="Transpose value")
329
- input_transpose_to_C4 = gr.Checkbox(label="Transpose to C4", value=False)
330
 
331
- run_btn = gr.Button("mix melody", variant="primary")
 
332
 
333
  gr.Markdown("## Output results")
334
 
@@ -338,34 +336,18 @@ if __name__ == "__main__":
338
  output_plot = gr.Plot(label="Output MIDI score plot")
339
  output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
340
 
341
-
342
- run_event = run_btn.click(Generate_Melody, [input_midi,
343
- input_find_best_match,
344
- input_adjust_melody_notes_durations,
345
- input_adjust_accompaniment_notes_durations,
346
- input_output_as_solo_piano,
347
- input_remove_drums,
348
- input_output_tempo,
349
- input_transform,
350
- input_transpose_to_C4,
351
- input_transpose_value
352
  ],
353
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
354
 
355
  gr.Examples(
356
- [["Abracadabra-Sample-Melody.mid", True, True, True, False, False, "Mix Melody", "As-is", False, 0],
357
- ["Sparks-Fly-Sample-Melody.mid", True, True, True, False, False, "Mix Melody", "As-is", False, 0],
358
  ],
359
- [input_midi,
360
- input_find_best_match,
361
- input_adjust_melody_notes_durations,
362
- input_adjust_accompaniment_notes_durations,
363
- input_output_as_solo_piano,
364
- input_remove_drums,
365
- input_output_tempo,
366
- input_transform,
367
- input_transpose_to_C4,
368
- input_transpose_value
369
  ],
370
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
371
  Generate_Melody,
 
312
  "Check out [Tegridy MIDI Dataset](https://github.com/asigalov61/Tegridy-MIDI-Dataset) on GitHub!\n\n"
313
  )
314
 
315
+ gr.Markdown("## Enter Parsons code below")
316
 
317
+ input_parsons_code = gr.Textbox(label="Enter your Parsons code here",
318
+ info="Make sure your code starts with *",
319
+ lines=1,
320
+ value="*",
321
+ ),
322
 
323
+ gr.Markdown("## Select generation options")
324
+
325
+ input_first_note_duration = gr.Slider(1, 127, value=15, step=1, label="First note duration value")
326
+ iinput_first_note_MIDI_pitch = gr.Slider(1, 127, value=60, step=1, label="First note MIDI pitch")
 
 
 
 
 
 
 
327
 
328
+ run_btn = gr.Button("Generate melody", variant="primary")
329
+ clear_btn = gr.ClearButton(components=[input_parsons_code])
330
 
331
  gr.Markdown("## Output results")
332
 
 
336
  output_plot = gr.Plot(label="Output MIDI score plot")
337
  output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
338
 
339
+ run_event = run_btn.click(Generate_Melody, [input_parsons_code,
340
+ input_first_note_duration,
341
+ iinput_first_note_MIDI_pitch,
 
 
 
 
 
 
 
 
342
  ],
343
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
344
 
345
  gr.Examples(
346
+ [["*UUUUUUUDDDDDDDUUUUUUUDDDDDDDUUUUUUUDDDDDDDUUUUUUUDDDDDDDUUUUUUU", 15, 60],
 
347
  ],
348
+ [input_parsons_code,
349
+ input_first_note_duration,
350
+ iinput_first_note_MIDI_pitch,
 
 
 
 
 
 
 
351
  ],
352
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
353
  Generate_Melody,