asigalov61 commited on
Commit
e229c68
·
1 Parent(s): 5b360d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -36,7 +36,7 @@ def generate(
36
 
37
  progress(0, desc="Starting...")
38
 
39
- for i in progress.tqdm(range(seq_len)):
40
 
41
  x = out[:, -max_seq_len:]
42
 
@@ -142,16 +142,16 @@ def GenerateMIDI():
142
 
143
  #=================================================================================================
144
 
145
- def cancel_run(output):
146
- if output is None:
147
  return None, None
148
  with open(f"Allegro-Music-Transformer-Music-Composition.mid", 'wb') as f:
149
- f.write(TMIDIX.score2midi(output))
150
- audio = synthesis(TMIDIX.score2opus(output), 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2')
151
  return "Allegro-Music-Transformer-Music-Composition.mid", (44100, audio), [create_msg("visualizer_end", None)]
152
 
153
  def load_javascript(dir="javascript"):
154
- scripts_list = glob.glob(f"*.js")
155
  javascript = ""
156
  for path in scripts_list:
157
  with open(path, "r", encoding="utf8") as jsfile:
 
36
 
37
  progress(0, desc="Starting...")
38
 
39
+ for i in progress.tqdm.tqdm(range(seq_len)):
40
 
41
  x = out[:, -max_seq_len:]
42
 
 
142
 
143
  #=================================================================================================
144
 
145
+ def cancel_run(output_midi_seq):
146
+ if output_midi_seq is None:
147
  return None, None
148
  with open(f"Allegro-Music-Transformer-Music-Composition.mid", 'wb') as f:
149
+ f.write(TMIDIX.score2midi(output_midi_seq))
150
+ audio = synthesis(TMIDIX.score2opus(output_midi_seq), 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2')
151
  return "Allegro-Music-Transformer-Music-Composition.mid", (44100, audio), [create_msg("visualizer_end", None)]
152
 
153
  def load_javascript(dir="javascript"):
154
+ scripts_list = glob.glob(f"app.js")
155
  javascript = ""
156
  for path in scripts_list:
157
  with open(path, "r", encoding="utf8") as jsfile: