asigalov61 commited on
Commit
331a729
·
verified ·
1 Parent(s): 671e0e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -213,8 +213,7 @@ def InpaintPitches(input_midi, input_num_of_notes, input_patch_number):
213
  inpaint_MIDI_patch = input_patch_number
214
 
215
  #@markdown Generation settings
216
-
217
- number_of_prime_tokens = 90 # @param {type:"slider", min:3, max:8190, step:3}
218
  number_of_memory_tokens = 1024 # @param {type:"slider", min:3, max:8190, step:3}
219
  number_of_samples_per_inpainted_note = 1 #@param {type:"slider", min:1, max:16, step:1}
220
  temperature = 0.85
@@ -223,7 +222,11 @@ def InpaintPitches(input_midi, input_num_of_notes, input_patch_number):
223
  print('Giant Music Transformer Inpainting Model Generator')
224
  print('=' * 70)
225
 
 
 
226
  nidx = 0
 
 
227
 
228
  for i, m in enumerate(melody_chords):
229
 
@@ -231,11 +234,19 @@ def InpaintPitches(input_midi, input_num_of_notes, input_patch_number):
231
 
232
  if 2304 <= melody_chords[i] < 18945 and (cpatch) == inpaint_MIDI_patch:
233
  nidx += 1
 
 
234
 
235
- if nidx == input_num_of_notes+(number_of_prime_tokens // 3):
 
 
 
 
236
  break
237
 
238
  nidx = i
 
 
239
 
240
  out2 = []
241
 
 
213
  inpaint_MIDI_patch = input_patch_number
214
 
215
  #@markdown Generation settings
216
+ number_of_prime_notes = 7
 
217
  number_of_memory_tokens = 1024 # @param {type:"slider", min:3, max:8190, step:3}
218
  number_of_samples_per_inpainted_note = 1 #@param {type:"slider", min:1, max:16, step:1}
219
  temperature = 0.85
 
222
  print('Giant Music Transformer Inpainting Model Generator')
223
  print('=' * 70)
224
 
225
+ #==========================================================================
226
+
227
  nidx = 0
228
+ first_inote = True
229
+ fidx = 0
230
 
231
  for i, m in enumerate(melody_chords):
232
 
 
234
 
235
  if 2304 <= melody_chords[i] < 18945 and (cpatch) == inpaint_MIDI_patch:
236
  nidx += 1
237
+ if first_inote:
238
+ fidx += 1
239
 
240
+ if fidx == number_of_prime_notes:
241
+ number_of_prime_tokens = i
242
+ first_inote = False
243
+
244
+ if nidx == input_num_of_notes:
245
  break
246
 
247
  nidx = i
248
+
249
+ #==========================================================================
250
 
251
  out2 = []
252