asigalov61 commited on
Commit
7055433
1 Parent(s): 331a729

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -213,7 +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
- 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
@@ -227,19 +227,23 @@ def InpaintPitches(input_midi, input_num_of_notes, input_patch_number):
227
  nidx = 0
228
  first_inote = True
229
  fidx = 0
 
 
230
 
231
  for i, m in enumerate(melody_chords):
232
-
233
- cpatch = (melody_chords[i]-2304) // 129
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
 
213
  inpaint_MIDI_patch = input_patch_number
214
 
215
  #@markdown Generation settings
216
+ number_of_prime_notes = 12
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
 
227
  nidx = 0
228
  first_inote = True
229
  fidx = 0
230
+
231
+ number_of_prime_tokens = number_of_prime_notes * 3
232
 
233
  for i, m in enumerate(melody_chords):
234
+
235
+ if 2304 <= melody_chords[i] < 18945:
236
+
237
+ cpatch = (melody_chords[i]-2304) // 129
238
+
239
+ if cpatch == inpaint_MIDI_patch:
240
+ nidx += 1
241
+ if first_inote:
242
+ fidx += 1
243
+
244
+ if first_inote and fidx == number_of_prime_notes:
245
+ number_of_prime_tokens = i
246
+ first_inote = False
247
 
248
  if nidx == input_num_of_notes:
249
  break