dx2102 commited on
Commit
ea123d1
·
verified ·
1 Parent(s): c069084

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -48,8 +48,6 @@ example_prefix = '''pitch duration wait velocity instrument
48
 
49
 
50
  def postprocess(txt, path):
51
- # assert txt.startswith(prompt)
52
- txt = txt.split('\n\n')[-1]
53
 
54
  # track = symusic.core.TrackSecond()
55
  tracks = {}
@@ -57,7 +55,8 @@ def postprocess(txt, path):
57
  now = 0
58
  # we need to ignore the invalid output by the model
59
  try:
60
- for line in txt.split('\n'):
 
61
  pitch, duration, wait, velocity, instrument = line.split()
62
  pitch, duration, wait, velocity = [int(x) for x in [pitch, duration, wait, velocity]]
63
  if instrument not in tracks:
 
48
 
49
 
50
  def postprocess(txt, path):
 
 
51
 
52
  # track = symusic.core.TrackSecond()
53
  tracks = {}
 
55
  now = 0
56
  # we need to ignore the invalid output by the model
57
  try:
58
+ # Remove the first three lines. 1: Score title, 2: The "pitch duration..." hint, 3: Empty line
59
+ for line in txt.split('\n')[3:]:
60
  pitch, duration, wait, velocity, instrument = line.split()
61
  pitch, duration, wait, velocity = [int(x) for x in [pitch, duration, wait, velocity]]
62
  if instrument not in tracks: