Commit
·
57c2abe
1
Parent(s):
a0865e1
(wip)add gpu tags
Browse files- app.py +1 -0
- cosyvoice/cli/cosyvoice.py +1 -1
- tts.py +2 -2
app.py
CHANGED
|
@@ -629,6 +629,7 @@ def generate_tts():
|
|
| 629 |
model_ids = []
|
| 630 |
|
| 631 |
# Function to process a single model (generate directly to TEMP_AUDIO_DIR, not cache subdir)
|
|
|
|
| 632 |
def process_model_on_the_fly(model):
|
| 633 |
# 传递 reference_audio_path 给 predict_tts
|
| 634 |
temp_audio_path = predict_tts(text, model.id, reference_audio_path=reference_audio_path)
|
|
|
|
| 629 |
model_ids = []
|
| 630 |
|
| 631 |
# Function to process a single model (generate directly to TEMP_AUDIO_DIR, not cache subdir)
|
| 632 |
+
@spaces.GPU
|
| 633 |
def process_model_on_the_fly(model):
|
| 634 |
# 传递 reference_audio_path 给 predict_tts
|
| 635 |
temp_audio_path = predict_tts(text, model.id, reference_audio_path=reference_audio_path)
|
cosyvoice/cli/cosyvoice.py
CHANGED
|
@@ -16,7 +16,7 @@ import spaces
|
|
| 16 |
import time
|
| 17 |
from tqdm import tqdm
|
| 18 |
from hyperpyyaml import load_hyperpyyaml
|
| 19 |
-
from
|
| 20 |
import torch
|
| 21 |
from cosyvoice.cli.cosyvoice import CosyVoiceFrontEnd
|
| 22 |
from cosyvoice.cli.cosyvoice import CosyVoiceModel, CosyVoice2Model
|
|
|
|
| 16 |
import time
|
| 17 |
from tqdm import tqdm
|
| 18 |
from hyperpyyaml import load_hyperpyyaml
|
| 19 |
+
from huggingface_hub import snapshot_download
|
| 20 |
import torch
|
| 21 |
from cosyvoice.cli.cosyvoice import CosyVoiceFrontEnd
|
| 22 |
from cosyvoice.cli.cosyvoice import CosyVoiceModel, CosyVoice2Model
|
tts.py
CHANGED
|
@@ -236,10 +236,10 @@ def predict_spark_tts(text, reference_audio_path=None):
|
|
| 236 |
def predict_cosyvoice_tts(text, reference_audio_path=None):
|
| 237 |
import tempfile
|
| 238 |
import soundfile as sf
|
| 239 |
-
from
|
| 240 |
model_dir = os.path.join(os.path.dirname(__file__), "CosyVoice2-0.5B", "pretrained_models", "CosyVoice2-0.5B")
|
| 241 |
if not os.path.exists(model_dir) or not os.listdir(model_dir):
|
| 242 |
-
snapshot_download('
|
| 243 |
sys.path.append(os.path.join(os.path.dirname(__file__), "CosyVoice2-0.5B"))
|
| 244 |
from cosyvoice.cli.cosyvoice import CosyVoice2
|
| 245 |
from cosyvoice.utils.file_utils import load_wav
|
|
|
|
| 236 |
def predict_cosyvoice_tts(text, reference_audio_path=None):
|
| 237 |
import tempfile
|
| 238 |
import soundfile as sf
|
| 239 |
+
from huggingface_hub import snapshot_download
|
| 240 |
model_dir = os.path.join(os.path.dirname(__file__), "CosyVoice2-0.5B", "pretrained_models", "CosyVoice2-0.5B")
|
| 241 |
if not os.path.exists(model_dir) or not os.listdir(model_dir):
|
| 242 |
+
snapshot_download('FunAudioLLM/CosyVoice2-0.5B', local_dir=model_dir)
|
| 243 |
sys.path.append(os.path.join(os.path.dirname(__file__), "CosyVoice2-0.5B"))
|
| 244 |
from cosyvoice.cli.cosyvoice import CosyVoice2
|
| 245 |
from cosyvoice.utils.file_utils import load_wav
|