Tim-gubski commited on
Commit
5c463b7
1 Parent(s): d9d438b
Files changed (3) hide show
  1. app.py +4 -1
  2. audio2hero.py +1 -0
  3. requirements.txt +2 -1
app.py CHANGED
@@ -1,9 +1,12 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
  from audio2hero import generate_midi
 
 
 
4
 
5
  gradio_app = gr.Interface(
6
- generate_midi,
7
  inputs=gr.Audio(label="Input Audio", type="filepath"),
8
  outputs=gr.File(label="Output MIDI Zip File"),
9
  title="Audio2Hero AI Autocharter for CloneHero",
 
1
  import gradio as gr
2
  from transformers import pipeline
3
  from audio2hero import generate_midi
4
+ import spaces
5
+
6
+
7
 
8
  gradio_app = gr.Interface(
9
+ spaces.GPU(generate_midi),
10
  inputs=gr.Audio(label="Input Audio", type="filepath"),
11
  outputs=gr.File(label="Output MIDI Zip File"),
12
  title="Audio2Hero AI Autocharter for CloneHero",
audio2hero.py CHANGED
@@ -12,6 +12,7 @@ def generate_midi(song_path, output_dir=None):
12
 
13
  print("Loading Model...")
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
15
  model = Pop2PianoForConditionalGeneration.from_pretrained("Tim-gubski/Audio2Hero").to(device)
16
  model.eval()
17
  processor = Pop2PianoProcessor.from_pretrained("sweetcocoa/pop2piano")
 
12
 
13
  print("Loading Model...")
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
+ print(f"Using {device}")
16
  model = Pop2PianoForConditionalGeneration.from_pretrained("Tim-gubski/Audio2Hero").to(device)
17
  model.eval()
18
  processor = Pop2PianoProcessor.from_pretrained("sweetcocoa/pop2piano")
requirements.txt CHANGED
@@ -5,4 +5,5 @@ essentia
5
  librosa
6
  scipy
7
  pydub
8
- resampy
 
 
5
  librosa
6
  scipy
7
  pydub
8
+ resampy
9
+ spaces