asigalov61 commited on
Commit
482801d
·
verified ·
1 Parent(s): f160b6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,4 +1,4 @@
1
- # https://huggingface.co/spaces/asigalov61/Melody2Song-Seq2Seq-Music-Transformer
2
 
3
  import os
4
  import time as reqtime
@@ -31,8 +31,8 @@ def GenerateSong(input_melody_seed_number):
31
 
32
  print('Loading model...')
33
 
34
- SEQ_LEN = 2560
35
- PAD_IDX = 514
36
  DEVICE = 'cuda' # 'cuda'
37
 
38
  # instantiate the model
@@ -43,7 +43,7 @@ def GenerateSong(input_melody_seed_number):
43
  attn_layers = Decoder(dim = 1024, depth = 32, heads = 16, attn_flash = True)
44
  )
45
 
46
- model = AutoregressiveWrapper(model, ignore_index = PAD_IDX)
47
 
48
  model.to(DEVICE)
49
  print('=' * 70)
@@ -203,10 +203,10 @@ if __name__ == "__main__":
203
  app = gr.Blocks()
204
 
205
  with app:
206
- gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Melody2Song Seq2Seq Music Transformer</h1>")
207
- gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Generate unique songs from melodies with seq2seq music transformer</h1>")
208
  gr.Markdown(
209
- "![Visitors](https://api.visitorbadge.io/api/visitors?path=asigalov61.Melody2Song-Seq2Seq-Music-Transformer&style=flat)\n\n")
210
 
211
  input_melody_seed_number = gr.Slider(0, 203664, value=0, step=1, label="Select seed melody number")
212
 
 
1
+ # https://huggingface.co/spaces/asigalov61/Bridge-Music-Transformer
2
 
3
  import os
4
  import time as reqtime
 
31
 
32
  print('Loading model...')
33
 
34
+ SEQ_LEN = 3074
35
+ PAD_IDX = 653
36
  DEVICE = 'cuda' # 'cuda'
37
 
38
  # instantiate the model
 
43
  attn_layers = Decoder(dim = 1024, depth = 32, heads = 16, attn_flash = True)
44
  )
45
 
46
+ model = AutoregressiveWrapper(model, ignore_index = PAD_IDX, pad_value=PAD_IDX)
47
 
48
  model.to(DEVICE)
49
  print('=' * 70)
 
203
  app = gr.Blocks()
204
 
205
  with app:
206
+ gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Bridge Music Transformer</h1>")
207
+ gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Generate a seamless bridge between two composition parts</h1>")
208
  gr.Markdown(
209
+ "![Visitors](https://api.visitorbadge.io/api/visitors?path=asigalov61.Bridge-Music-Transformer&style=flat)\n\n")
210
 
211
  input_melody_seed_number = gr.Slider(0, 203664, value=0, step=1, label="Select seed melody number")
212