xjsc0 commited on
Commit
0fcfe66
·
1 Parent(s): 3f33afc
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -25,10 +25,10 @@ HF_ENABLE = False
25
  LOCAL_DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
26
 
27
 
28
- def gpu_decorator(fn):
29
- if IS_HF_SPACE and HF_ENABLE and spaces is not None:
30
- return spaces.GPU(fn)
31
- return fn
32
 
33
 
34
  def local_move2gpu(x):
@@ -45,7 +45,7 @@ _model = None
45
  _separator = None
46
 
47
 
48
- @gpu_decorator
49
  def get_model():
50
  """加载 YingMusicSinger 模型 / Load YingMusicSinger model."""
51
  download_files(task="infer")
@@ -59,7 +59,7 @@ def get_model():
59
  return _model
60
 
61
 
62
- @gpu_decorator
63
  def get_separator():
64
  """
65
  加载 MelBandRoformer 分离模型 / Load MelBandRoformer separator.
@@ -83,7 +83,7 @@ def get_separator():
83
  # ---------------------------------------------------------------------------
84
  # Vocal separation utilities / 人声分离工具
85
  # ---------------------------------------------------------------------------
86
- @gpu_decorator
87
  def separate_vocals(
88
  audio_path: str,
89
  device: str = "cuda:0",
@@ -151,7 +151,7 @@ def mix_vocal_and_accompaniment(
151
  # ---------------------------------------------------------------------------
152
  # Inference wrapper / 推理入口
153
  # ---------------------------------------------------------------------------
154
- @gpu_decorator
155
  def synthesize(
156
  ref_audio,
157
  melody_audio,
 
25
  LOCAL_DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
26
 
27
 
28
+ # def gpu_decorator(fn):
29
+ # if IS_HF_SPACE and HF_ENABLE and spaces is not None:
30
+ # return spaces.GPU(fn)
31
+ # return fn
32
 
33
 
34
  def local_move2gpu(x):
 
45
  _separator = None
46
 
47
 
48
+ @spaces.GPU
49
  def get_model():
50
  """加载 YingMusicSinger 模型 / Load YingMusicSinger model."""
51
  download_files(task="infer")
 
59
  return _model
60
 
61
 
62
+ @spaces.GPU
63
  def get_separator():
64
  """
65
  加载 MelBandRoformer 分离模型 / Load MelBandRoformer separator.
 
83
  # ---------------------------------------------------------------------------
84
  # Vocal separation utilities / 人声分离工具
85
  # ---------------------------------------------------------------------------
86
+ @spaces.GPU
87
  def separate_vocals(
88
  audio_path: str,
89
  device: str = "cuda:0",
 
151
  # ---------------------------------------------------------------------------
152
  # Inference wrapper / 推理入口
153
  # ---------------------------------------------------------------------------
154
+ @spaces.GPU
155
  def synthesize(
156
  ref_audio,
157
  melody_audio,