mrfakename commited on
Commit
a97e9bb
1 Parent(s): e3212c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -9,7 +9,8 @@ from glob import glob
9
  import librosa
10
  from midi2audio import FluidSynth
11
  fs = FluidSynth()
12
-
 
13
  def gen(piano_only, piano_seed, length):
14
  midi = ''
15
  if piano_seed:
@@ -28,7 +29,7 @@ def gen(piano_only, piano_seed, length):
28
  fs.midi_to_audio(tmp.name, aud.name)
29
  yield midi, tmp.name, aud.name
30
  with gr.Blocks() as demo:
31
- gr.Markdown("# RWKV 4 Music (MIDI)\n\nThis demo uses the RWKV 4 MIDI model available [here](https://huggingface.co/BlinkDL/rwkv-4-music/blob/main/RWKV-4-MIDI-560M-v1-20230717-ctx4096.pth). Details may be found [here](https://huggingface.co/BlinkDL/rwkv-4-music). The music generation code may be found [here](https://github.com/BlinkDL/ChatRWKV/tree/main/music). The MIDI Tokenizer may be found [here](https://github.com/briansemrau/MIDI-LLM-tokenizer).\n\nNot sure how to play MIDI files? I recommend using the open source [VLC Media Player](https://www.videolan.org/vlc/) with can play MIDI files using FluidSynth.\n\nYou are responsible for your usage.\n\n**NOTE:** This Space will be quite slow since it's CPU-only. Please duplicate with a GPU if you'd like a faster version or run it locally")
32
  piano_only = gr.Checkbox(label="Piano Only")
33
  piano_seed = gr.Checkbox(label="Use Piano Melody Seed")
34
  length = gr.Slider(label="Max Length (in tokens)", minimum=4, maximum=4096, step=1, value=512, info="The audio may still be shorter than this")
 
9
  import librosa
10
  from midi2audio import FluidSynth
11
  fs = FluidSynth()
12
+ import spaces
13
+ @spaces.GPU(enable_queue=True)
14
  def gen(piano_only, piano_seed, length):
15
  midi = ''
16
  if piano_seed:
 
29
  fs.midi_to_audio(tmp.name, aud.name)
30
  yield midi, tmp.name, aud.name
31
  with gr.Blocks() as demo:
32
+ gr.Markdown("# RWKV 4 Music (MIDI)\n\nThis demo uses the RWKV 4 MIDI model available [here](https://huggingface.co/BlinkDL/rwkv-4-music/blob/main/RWKV-4-MIDI-560M-v1-20230717-ctx4096.pth). Details may be found [here](https://huggingface.co/BlinkDL/rwkv-4-music). The music generation code may be found [here](https://github.com/BlinkDL/ChatRWKV/tree/main/music). The MIDI Tokenizer may be found [here](https://github.com/briansemrau/MIDI-LLM-tokenizer).\n\nNot sure how to play MIDI files? I recommend using the open source [VLC Media Player](https://www.videolan.org/vlc/) with can play MIDI files using FluidSynth.\n\nYou are responsible for your usage.")
33
  piano_only = gr.Checkbox(label="Piano Only")
34
  piano_seed = gr.Checkbox(label="Use Piano Melody Seed")
35
  length = gr.Slider(label="Max Length (in tokens)", minimum=4, maximum=4096, step=1, value=512, info="The audio may still be shorter than this")