projectlosangeles commited on
Commit
8d41287
·
verified ·
1 Parent(s): f6d08a7

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -1,12 +1,12 @@
1
  #==================================================================================
2
- # https://huggingface.co/spaces/projectlosangeles/MuseCraft-Piano-Chords-Texturing
3
  #==================================================================================
4
 
5
  print('=' * 70)
6
- print('MuseCraft Piano Chords Texturing Gradio App')
7
 
8
  print('=' * 70)
9
- print('Loading core MuseCraft Piano Chords Texturing modules...')
10
 
11
  import os
12
  import copy
@@ -16,7 +16,7 @@ import datetime
16
  from pytz import timezone
17
 
18
  print('=' * 70)
19
- print('Loading main MuseCraft Piano Chords Texturing modules...')
20
 
21
  os.environ['USE_FLASH_ATTENTION'] = '1'
22
 
@@ -43,7 +43,7 @@ import random
43
  import tqdm
44
 
45
  print('=' * 70)
46
- print('Loading aux MuseCraft Piano Chords Texturing modules...')
47
 
48
  import matplotlib.pyplot as plt
49
 
@@ -72,7 +72,7 @@ MAX_GEN_TOKS = 3072
72
  print('=' * 70)
73
  print('Loading popular hook melodies dataset...')
74
 
75
- popular_hook_melodies_pickle = hf_hub_download(repo_id='projectlosangeles/MuseCraft-Piano-Chords-Texturing',
76
  filename='popular_hook_melodies_24_64_CC_BY_NC_SA.pickle'
77
  )
78
 
@@ -112,7 +112,7 @@ model = AutoregressiveWrapper(model, ignore_index=PAD_IDX, pad_value=PAD_IDX)
112
  print('=' * 70)
113
  print('Loading model checkpoint...')
114
 
115
- model_checkpoint = hf_hub_download(repo_id='projectlosangeles/MuseCraft-Piano-Chords-Texturing', filename=MODEL_CHECKPOINT)
116
 
117
  model.load_state_dict(torch.load(model_checkpoint, map_location='cpu', weights_only=True))
118
 
@@ -348,10 +348,10 @@ def Generate_Accompaniment(input_midi,
348
 
349
  song_f.append(['note', time, dur, channel, pitch, vel, patch])
350
 
351
- fn1 = "MuseCraft-Piano-Chords-Texturing-Composition"
352
 
353
  detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
354
- output_signature = 'MuseCraft Piano Chords Texturing',
355
  output_file_name = fn1,
356
  track_name='Project Los Angeles',
357
  list_of_MIDI_patches=patches_map
@@ -405,11 +405,11 @@ with gr.Blocks() as demo:
405
 
406
  #==================================================================================
407
 
408
- gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>MuseCraft Piano Chords Texturing</h1>")
409
- gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Solo Piano chords texturing model for MuseCraft project</h1>")
410
  gr.HTML("""
411
  <p>
412
- <a href="https://huggingface.co/spaces/projectlosangeles/MuseCraft-Piano-Chords-Texturing?duplicate=true">
413
  <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-md.svg" alt="Duplicate in Hugging Face">
414
  </a>
415
  </p>
@@ -420,6 +420,7 @@ with gr.Blocks() as demo:
420
  #==================================================================================
421
 
422
  gr.Markdown("## Upload source melody MIDI or enter a search query for a sample melody below")
 
423
 
424
  input_midi = gr.File(label="Input MIDI",
425
  file_types=[".midi", ".mid", ".kar"]
 
1
  #==================================================================================
2
+ # https://huggingface.co/spaces/projectlosangeles/Godzilla-Piano-Chords-Texturing
3
  #==================================================================================
4
 
5
  print('=' * 70)
6
+ print('Godzilla Piano Chords Texturing Gradio App')
7
 
8
  print('=' * 70)
9
+ print('Loading core Godzilla Piano Chords Texturing modules...')
10
 
11
  import os
12
  import copy
 
16
  from pytz import timezone
17
 
18
  print('=' * 70)
19
+ print('Loading main Godzilla Piano Chords Texturing modules...')
20
 
21
  os.environ['USE_FLASH_ATTENTION'] = '1'
22
 
 
43
  import tqdm
44
 
45
  print('=' * 70)
46
+ print('Loading aux Godzilla Piano Chords Texturing modules...')
47
 
48
  import matplotlib.pyplot as plt
49
 
 
72
  print('=' * 70)
73
  print('Loading popular hook melodies dataset...')
74
 
75
+ popular_hook_melodies_pickle = hf_hub_download(repo_id='projectlosangeles/Godzilla-Piano-Chords-Texturing',
76
  filename='popular_hook_melodies_24_64_CC_BY_NC_SA.pickle'
77
  )
78
 
 
112
  print('=' * 70)
113
  print('Loading model checkpoint...')
114
 
115
+ model_checkpoint = hf_hub_download(repo_id='projectlosangeles/Godzilla-Piano-Chords-Texturing', filename=MODEL_CHECKPOINT)
116
 
117
  model.load_state_dict(torch.load(model_checkpoint, map_location='cpu', weights_only=True))
118
 
 
348
 
349
  song_f.append(['note', time, dur, channel, pitch, vel, patch])
350
 
351
+ fn1 = "Godzilla-Piano-Chords-Texturing-Composition"
352
 
353
  detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
354
+ output_signature = 'Godzilla Piano Chords Texturing',
355
  output_file_name = fn1,
356
  track_name='Project Los Angeles',
357
  list_of_MIDI_patches=patches_map
 
405
 
406
  #==================================================================================
407
 
408
+ gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Godzilla Piano Chords Texturing</h1>")
409
+ gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Solo Piano chords texturing music transformer</h1>")
410
  gr.HTML("""
411
  <p>
412
+ <a href="https://huggingface.co/spaces/projectlosangeles/Godzilla-Piano-Chords-Texturing?duplicate=true">
413
  <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-md.svg" alt="Duplicate in Hugging Face">
414
  </a>
415
  </p>
 
420
  #==================================================================================
421
 
422
  gr.Markdown("## Upload source melody MIDI or enter a search query for a sample melody below")
423
+ gr.Markdown("### (PLEASE NOTE: The demo is limited and will only texture first 128 chords of the MIDI file")
424
 
425
  input_midi = gr.File(label="Input MIDI",
426
  file_types=[".midi", ".mid", ".kar"]