lllindsey0615 commited on
Commit
83ca69a
·
1 Parent(s): 31bdbd1

enable zerogpu

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -5,6 +5,7 @@ from demucs import pretrained
5
  from demucs.apply import apply_model
6
  from pyharp import *
7
  from audiotools import AudioSignal
 
8
 
9
  # Available Demucs models
10
  DEMUX_MODELS = ["mdx_extra_q", "mdx_extra", "htdemucs", "mdx_q"]
@@ -17,7 +18,7 @@ STEM_CHOICES = {
17
  "Instrumental (No Vocals)": "instrumental"
18
  }
19
 
20
-
21
  def separate_stem(audio_file_path: str, model_name: str, stem_choice: str):
22
  """
23
  Separates an audio file into the chosen stem using a Demucs model.
@@ -65,7 +66,6 @@ def separate_stem(audio_file_path: str, model_name: str, stem_choice: str):
65
  stem_signal = AudioSignal(stem.cpu().numpy().astype('float32'), sample_rate=sr)
66
  return stem_signal
67
 
68
-
69
  def process_fn_stem(audio_file_path: str, demucs_model: str, stem_choice: str):
70
  """
71
  PyHARP process function:
 
5
  from demucs.apply import apply_model
6
  from pyharp import *
7
  from audiotools import AudioSignal
8
+ import spaces
9
 
10
  # Available Demucs models
11
  DEMUX_MODELS = ["mdx_extra_q", "mdx_extra", "htdemucs", "mdx_q"]
 
18
  "Instrumental (No Vocals)": "instrumental"
19
  }
20
 
21
+ @spaces.GPU
22
  def separate_stem(audio_file_path: str, model_name: str, stem_choice: str):
23
  """
24
  Separates an audio file into the chosen stem using a Demucs model.
 
66
  stem_signal = AudioSignal(stem.cpu().numpy().astype('float32'), sample_rate=sr)
67
  return stem_signal
68
 
 
69
  def process_fn_stem(audio_file_path: str, demucs_model: str, stem_choice: str):
70
  """
71
  PyHARP process function: