asigalov61 commited on
Commit
bc6831a
·
verified ·
1 Parent(s): 890ef0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -281,6 +281,10 @@ def generate_music(prime,
281
  inputs.extend([0, ((8*8)+6)+256, ((128*129)+drum_pitch)+2304])
282
 
283
  torch.cuda.empty_cache()
 
 
 
 
284
 
285
  inp = [inputs] * num_gen_batches
286
 
@@ -306,6 +310,9 @@ def generate_music(prime,
306
 
307
  else:
308
  output_batches = output
 
 
 
309
 
310
  return output_batches
311
 
@@ -398,6 +405,10 @@ def generate_callback_wrapper(input_midi,
398
  model_sampling_top_p
399
  ):
400
 
 
 
 
 
401
  print('=' * 70)
402
  if input_midi is not None:
403
  fn = os.path.basename(input_midi.name)
@@ -422,6 +433,12 @@ def generate_callback_wrapper(input_midi,
422
  )
423
 
424
  generated_batches.extend([sublist[2] for sublist in result])
 
 
 
 
 
 
425
 
426
  return tuple(item for sublist in result for item in sublist[:2])
427
 
 
281
  inputs.extend([0, ((8*8)+6)+256, ((128*129)+drum_pitch)+2304])
282
 
283
  torch.cuda.empty_cache()
284
+ model.cuda()
285
+ model.eval()
286
+
287
+ print('Generating...')
288
 
289
  inp = [inputs] * num_gen_batches
290
 
 
310
 
311
  else:
312
  output_batches = output
313
+
314
+ print('Done!')
315
+ print('=' * 70)
316
 
317
  return output_batches
318
 
 
405
  model_sampling_top_p
406
  ):
407
 
408
+ print('=' * 70)
409
+ print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
410
+ start_time = reqtime.time()
411
+
412
  print('=' * 70)
413
  if input_midi is not None:
414
  fn = os.path.basename(input_midi.name)
 
433
  )
434
 
435
  generated_batches.extend([sublist[2] for sublist in result])
436
+
437
+ print('=' * 70)
438
+ print('Req end time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
439
+ print('=' * 70)
440
+ print('Req execution time:', (reqtime.time() - start_time), 'sec')
441
+ print('*' * 70)
442
 
443
  return tuple(item for sublist in result for item in sublist[:2])
444