asigalov61 commited on
Commit
9b24b99
·
verified ·
1 Parent(s): 2c6a087

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -253,6 +253,12 @@ def save_midi(tokens, batch_number=None):
253
 
254
  return song_f
255
 
 
 
 
 
 
 
256
  #==================================================================================
257
 
258
  @spaces.GPU
@@ -469,7 +475,7 @@ def add_batch(batch_number):
469
 
470
  def remove_batch(batch_number, num_tokens):
471
 
472
- # global final_composition
473
 
474
  if len(final_composition) > num_tokens:
475
  final_composition = final_composition[:-num_tokens]
@@ -500,9 +506,9 @@ def remove_batch(batch_number, num_tokens):
500
 
501
  def reset():
502
 
503
- # global final_composition
504
- # global generated_batches
505
- # global block_lines
506
 
507
  final_composition = []
508
  generated_batches = []
@@ -539,12 +545,6 @@ with gr.Blocks() as demo:
539
 
540
  #==================================================================================
541
 
542
- final_composition = gr.State([])
543
- generated_batches = gr.State([])
544
- block_lines = gr.State([])
545
-
546
- #==================================================================================
547
-
548
  gr.Markdown("## Upload seed MIDI or click 'Generate' button for random output")
549
 
550
  input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
 
253
 
254
  return song_f
255
 
256
+ #==================================================================================
257
+
258
+ final_composition = []
259
+ generated_batches = []
260
+ block_lines = []
261
+
262
  #==================================================================================
263
 
264
  @spaces.GPU
 
475
 
476
  def remove_batch(batch_number, num_tokens):
477
 
478
+ global final_composition
479
 
480
  if len(final_composition) > num_tokens:
481
  final_composition = final_composition[:-num_tokens]
 
506
 
507
  def reset():
508
 
509
+ global final_composition
510
+ global generated_batches
511
+ global block_lines
512
 
513
  final_composition = []
514
  generated_batches = []
 
545
 
546
  #==================================================================================
547
 
 
 
 
 
 
 
548
  gr.Markdown("## Upload seed MIDI or click 'Generate' button for random output")
549
 
550
  input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])