Spaces:
Runtime error
Runtime error
feat: install
Browse files- GPT_SoVITS/inference_webui.py +24 -3
- README.md +3 -0
GPT_SoVITS/inference_webui.py
CHANGED
@@ -7,6 +7,7 @@
|
|
7 |
全部按日文识别
|
8 |
"""
|
9 |
|
|
|
10 |
from module.mel_processing import mel_spectrogram_torch, spectrogram_torch
|
11 |
from text import chinese
|
12 |
from sv import SV
|
@@ -34,12 +35,30 @@ import re
|
|
34 |
import sys
|
35 |
import traceback
|
36 |
import warnings
|
37 |
-
import spaces
|
38 |
-
|
39 |
import torch
|
40 |
import torchaudio
|
41 |
from text.LangSegmenter import LangSegmenter
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
# 保存原始构造器
|
44 |
original_storage_new = torch.UntypedStorage.__new__
|
45 |
|
@@ -76,7 +95,7 @@ logging.getLogger("charset_normalizer").setLevel(logging.ERROR)
|
|
76 |
logging.getLogger("torchaudio._extension").setLevel(logging.ERROR)
|
77 |
logging.getLogger("multipart.multipart").setLevel(logging.ERROR)
|
78 |
warnings.simplefilter(action="ignore", category=FutureWarning)
|
79 |
-
os.system("bash install.sh")
|
80 |
version = model_version = os.environ.get("version", "v2")
|
81 |
|
82 |
|
@@ -770,6 +789,8 @@ def audio_sr(audio, sr):
|
|
770 |
cache = {}
|
771 |
|
772 |
|
|
|
|
|
773 |
def get_tts_wav(
|
774 |
ref_wav_path,
|
775 |
prompt_text,
|
|
|
7 |
全部按日文识别
|
8 |
"""
|
9 |
|
10 |
+
import spaces
|
11 |
from module.mel_processing import mel_spectrogram_torch, spectrogram_torch
|
12 |
from text import chinese
|
13 |
from sv import SV
|
|
|
35 |
import sys
|
36 |
import traceback
|
37 |
import warnings
|
|
|
|
|
38 |
import torch
|
39 |
import torchaudio
|
40 |
from text.LangSegmenter import LangSegmenter
|
41 |
|
42 |
+
import zipfile
|
43 |
+
from huggingface_hub import hf_hub_download
|
44 |
+
import nltk
|
45 |
+
nltk.download(['averaged_perceptron_tagger',
|
46 |
+
'averaged_perceptron_tagger_eng', 'cmudict'])
|
47 |
+
|
48 |
+
zip_targets = {
|
49 |
+
"pretrained_models.zip": "/home/user/app",
|
50 |
+
"G2PWModel.zip": "/home/user/app/text"
|
51 |
+
}
|
52 |
+
repo_id = "XXXXRT/GPT-SoVITS-Pretrained"
|
53 |
+
|
54 |
+
for filename, target_dir in zip_targets.items():
|
55 |
+
zip_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
56 |
+
os.makedirs(target_dir, exist_ok=True)
|
57 |
+
with zipfile.ZipFile(zip_path, "r") as zip_ref:
|
58 |
+
zip_ref.extractall(target_dir)
|
59 |
+
print(f"{filename} 已解压到 {target_dir}")
|
60 |
+
|
61 |
+
|
62 |
# 保存原始构造器
|
63 |
original_storage_new = torch.UntypedStorage.__new__
|
64 |
|
|
|
95 |
logging.getLogger("torchaudio._extension").setLevel(logging.ERROR)
|
96 |
logging.getLogger("multipart.multipart").setLevel(logging.ERROR)
|
97 |
warnings.simplefilter(action="ignore", category=FutureWarning)
|
98 |
+
# os.system("bash install.sh")
|
99 |
version = model_version = os.environ.get("version", "v2")
|
100 |
|
101 |
|
|
|
789 |
cache = {}
|
790 |
|
791 |
|
792 |
+
@torch.inference_mode()
|
793 |
+
@spaces.GPU
|
794 |
def get_tts_wav(
|
795 |
ref_wav_path,
|
796 |
prompt_text,
|
README.md
CHANGED
@@ -8,6 +8,9 @@ sdk_version: 5.33.0
|
|
8 |
app_file: GPT_SoVITS/inference_webui.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
|
|
|
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
8 |
app_file: GPT_SoVITS/inference_webui.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
+
preload_from_hub:
|
12 |
+
- XXXXRT/GPT-SoVITS-Pretrained pretrained_models.zip
|
13 |
+
- XXXXRT/GPT-SoVITS-Pretrained G2PWModel.zip
|
14 |
---
|
15 |
|
16 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|