Spaces:
Running on Zero
Running on Zero
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 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
|
| 34 |
def local_move2gpu(x):
|
|
@@ -45,7 +45,7 @@ _model = None
|
|
| 45 |
_separator = None
|
| 46 |
|
| 47 |
|
| 48 |
-
@
|
| 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 |
-
@
|
| 63 |
def get_separator():
|
| 64 |
"""
|
| 65 |
加载 MelBandRoformer 分离模型 / Load MelBandRoformer separator.
|
|
@@ -83,7 +83,7 @@ def get_separator():
|
|
| 83 |
# ---------------------------------------------------------------------------
|
| 84 |
# Vocal separation utilities / 人声分离工具
|
| 85 |
# ---------------------------------------------------------------------------
|
| 86 |
-
@
|
| 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 |
-
@
|
| 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,
|