asigalov61 commited on
Commit
70199bd
1 Parent(s): e2681d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -21,7 +21,7 @@ from midi_to_colab_audio import midi_to_colab_audio
21
  # =================================================================================================
22
 
23
  @spaces.GPU
24
- def GenerateSong(input_melody_seed_number):
25
  print('=' * 70)
26
  print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
27
  start_time = reqtime.time()
@@ -204,8 +204,15 @@ if __name__ == "__main__":
204
  gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Generate unique rock music compositions with source augmented RoPE music transformer</h1>")
205
  gr.Markdown(
206
  "![Visitors](https://api.visitorbadge.io/api/visitors?path=asigalov61.Guided-Rock-Music-Transformer&style=flat)\n\n")
 
 
 
 
207
 
 
 
208
  input_melody_seed_number = gr.Slider(0, 203664, value=0, step=1, label="Select seed melody number")
 
209
 
210
  run_btn = gr.Button("generate", variant="primary")
211
 
@@ -217,7 +224,19 @@ if __name__ == "__main__":
217
  output_plot = gr.Plot(label="Output MIDI score plot")
218
  output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
219
 
220
- run_event = run_btn.click(GenerateSong, [input_melody_seed_number],
221
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
222
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  app.queue().launch()
 
21
  # =================================================================================================
22
 
23
  @spaces.GPU
24
+ def Generate_Rock_Song(input_melody_seed_number):
25
  print('=' * 70)
26
  print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
27
  start_time = reqtime.time()
 
204
  gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Generate unique rock music compositions with source augmented RoPE music transformer</h1>")
205
  gr.Markdown(
206
  "![Visitors](https://api.visitorbadge.io/api/visitors?path=asigalov61.Guided-Rock-Music-Transformer&style=flat)\n\n")
207
+
208
+ gr.Markdown("## Upload your MIDI or select a sample example MIDI below")
209
+
210
+ input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
211
 
212
+ gr.Markdown("## Select generation options")
213
+
214
  input_melody_seed_number = gr.Slider(0, 203664, value=0, step=1, label="Select seed melody number")
215
+ input_find_best_match = gr.Checkbox(label="Find best match", value=False)
216
 
217
  run_btn = gr.Button("generate", variant="primary")
218
 
 
224
  output_plot = gr.Plot(label="Output MIDI score plot")
225
  output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
226
 
227
+ run_event = run_btn.click(Generate_Rock_Song, [input_melody_seed_number],
228
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
229
 
230
+ gr.Examples(
231
+ [["Sharing The Night Together.kar", 0, True],
232
+ ],
233
+ [input_midi,
234
+ input_melody_seed_number,
235
+ input_find_best_match,
236
+ ],
237
+ [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
238
+ Generate_Rock_Song,
239
+ cache_examples=False,
240
+ )
241
+
242
  app.queue().launch()