Spaces:
Build error
Build error
SayaSS
commited on
Commit
•
b54579f
1
Parent(s):
d95ac39
fix audio
Browse files- .gitignore +3 -1
- app.py +22 -8
- pretrained_models/info.json +36 -12
.gitignore
CHANGED
@@ -377,4 +377,6 @@ monotonic_align/core.c
|
|
377 |
/resources
|
378 |
/MoeGoe.spec
|
379 |
/dist/MoeGoe
|
380 |
-
/dist
|
|
|
|
|
|
377 |
/resources
|
378 |
/MoeGoe.spec
|
379 |
/dist/MoeGoe
|
380 |
+
/dist
|
381 |
+
|
382 |
+
.idea
|
app.py
CHANGED
@@ -10,12 +10,24 @@ import gradio as gr
|
|
10 |
from models import SynthesizerTrn
|
11 |
from text import text_to_sequence
|
12 |
from torch import no_grad, LongTensor
|
|
|
13 |
import logging
|
14 |
logging.getLogger('numba').setLevel(logging.WARNING)
|
15 |
limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
|
16 |
|
17 |
hps_ms = utils.get_hparams_from_file(r'config/config.json')
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
def get_text(text, hps):
|
20 |
text_norm, clean_text = text_to_sequence(text, hps.symbols, hps.data.text_cleaners)
|
21 |
if hps.data.add_blank:
|
@@ -92,6 +104,8 @@ if __name__ == '__main__':
|
|
92 |
name_zh = info['name_zh']
|
93 |
title = info['title']
|
94 |
cover = f"pretrained_models/{i}/{info['cover']}"
|
|
|
|
|
95 |
net_g_ms = SynthesizerTrn(
|
96 |
len(hps_ms.symbols),
|
97 |
hps_ms.data.filter_length // 2 + 1,
|
@@ -100,19 +114,19 @@ if __name__ == '__main__':
|
|
100 |
**hps_ms.model)
|
101 |
utils.load_checkpoint(f'pretrained_models/{i}/{i}.pth', net_g_ms, None)
|
102 |
_ = net_g_ms.eval().to(device)
|
103 |
-
models.append((sid, name_en, name_zh, title, cover, net_g_ms, create_tts_fn(net_g_ms, sid)))
|
104 |
with gr.Blocks() as app:
|
105 |
gr.Markdown(
|
106 |
"# <center> vits-models\n"
|
107 |
"![visitor badge](https://visitor-badge.glitch.me/badge?page_id=sayashi.vits-models)\n\n"
|
108 |
"[Open In Colab]"
|
109 |
"(https://colab.research.google.com/drive/10QOk9NPgoKZUXkIhhuVaZ7SYra1MPMKH?usp=share_link)"
|
110 |
-
" without queue and length limitation
|
111 |
)
|
112 |
|
113 |
with gr.Tabs():
|
114 |
with gr.TabItem("EN"):
|
115 |
-
for (sid, name_en, name_zh, title, cover, net_g_ms, tts_fn) in models:
|
116 |
with gr.TabItem(name_en):
|
117 |
with gr.Row():
|
118 |
gr.Markdown(
|
@@ -123,9 +137,9 @@ if __name__ == '__main__':
|
|
123 |
)
|
124 |
with gr.Row():
|
125 |
with gr.Column():
|
126 |
-
input_text = gr.Textbox(label="Text (100 words limitation)", lines=5, value=
|
127 |
lang = gr.Dropdown(label="Language", choices=["Chinese", "Japanese", "Mix(wrap the Chinese text with [ZH][ZH], wrap the Japanese text with [JA][JA])"],
|
128 |
-
type="index", value=
|
129 |
btn = gr.Button(value="Generate")
|
130 |
with gr.Row():
|
131 |
ns = gr.Slider(label="noise_scale", minimum=0.1, maximum=1.0, step=0.1, value=0.6, interactive=True)
|
@@ -139,7 +153,7 @@ if __name__ == '__main__':
|
|
139 |
download.click(None, [], [], _js=download_audio_js.format(audio_id=f"en-{name_en.replace(' ','')}"))
|
140 |
lang.change(change_lang, inputs=[lang], outputs=[ns, nsw, ls])
|
141 |
with gr.TabItem("中文"):
|
142 |
-
for (sid, name_en, name_zh, title, cover, net_g_ms, tts_fn) in models:
|
143 |
with gr.TabItem(name_zh):
|
144 |
with gr.Row():
|
145 |
gr.Markdown(
|
@@ -150,9 +164,9 @@ if __name__ == '__main__':
|
|
150 |
)
|
151 |
with gr.Row():
|
152 |
with gr.Column():
|
153 |
-
input_text = gr.Textbox(label="文本 (100字上限)", lines=5, value=
|
154 |
lang = gr.Dropdown(label="语言", choices=["中文", "日语", "中日混合(中文用[ZH][ZH]包裹起来,日文用[JA][JA]包裹起来)"],
|
155 |
-
type="index", value="日语")
|
156 |
btn = gr.Button(value="生成")
|
157 |
with gr.Row():
|
158 |
ns = gr.Slider(label="控制感情变化程度", minimum=0.1, maximum=1.0, step=0.1, value=0.6, interactive=True)
|
|
|
10 |
from models import SynthesizerTrn
|
11 |
from text import text_to_sequence
|
12 |
from torch import no_grad, LongTensor
|
13 |
+
import gradio.processing_utils as gr_processing_utils
|
14 |
import logging
|
15 |
logging.getLogger('numba').setLevel(logging.WARNING)
|
16 |
limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
|
17 |
|
18 |
hps_ms = utils.get_hparams_from_file(r'config/config.json')
|
19 |
|
20 |
+
audio_postprocess_ori = gr.Audio.postprocess
|
21 |
+
|
22 |
+
def audio_postprocess(self, y):
|
23 |
+
data = audio_postprocess_ori(self, y)
|
24 |
+
if data is None:
|
25 |
+
return None
|
26 |
+
return gr_processing_utils.encode_url_or_file_to_base64(data["name"])
|
27 |
+
|
28 |
+
|
29 |
+
gr.Audio.postprocess = audio_postprocess
|
30 |
+
|
31 |
def get_text(text, hps):
|
32 |
text_norm, clean_text = text_to_sequence(text, hps.symbols, hps.data.text_cleaners)
|
33 |
if hps.data.add_blank:
|
|
|
104 |
name_zh = info['name_zh']
|
105 |
title = info['title']
|
106 |
cover = f"pretrained_models/{i}/{info['cover']}"
|
107 |
+
example = info['example']
|
108 |
+
language = info['language']
|
109 |
net_g_ms = SynthesizerTrn(
|
110 |
len(hps_ms.symbols),
|
111 |
hps_ms.data.filter_length // 2 + 1,
|
|
|
114 |
**hps_ms.model)
|
115 |
utils.load_checkpoint(f'pretrained_models/{i}/{i}.pth', net_g_ms, None)
|
116 |
_ = net_g_ms.eval().to(device)
|
117 |
+
models.append((sid, name_en, name_zh, title, cover, example, language, net_g_ms, create_tts_fn(net_g_ms, sid)))
|
118 |
with gr.Blocks() as app:
|
119 |
gr.Markdown(
|
120 |
"# <center> vits-models\n"
|
121 |
"![visitor badge](https://visitor-badge.glitch.me/badge?page_id=sayashi.vits-models)\n\n"
|
122 |
"[Open In Colab]"
|
123 |
"(https://colab.research.google.com/drive/10QOk9NPgoKZUXkIhhuVaZ7SYra1MPMKH?usp=share_link)"
|
124 |
+
" without queue and length limitation.(无需等待队列,并且没有长度限制)\n\n"
|
125 |
)
|
126 |
|
127 |
with gr.Tabs():
|
128 |
with gr.TabItem("EN"):
|
129 |
+
for (sid, name_en, name_zh, title, cover, example, language, net_g_ms, tts_fn) in models:
|
130 |
with gr.TabItem(name_en):
|
131 |
with gr.Row():
|
132 |
gr.Markdown(
|
|
|
137 |
)
|
138 |
with gr.Row():
|
139 |
with gr.Column():
|
140 |
+
input_text = gr.Textbox(label="Text (100 words limitation)", lines=5, value=example, elem_id=f"input-text-en-{name_en.replace(' ','')}")
|
141 |
lang = gr.Dropdown(label="Language", choices=["Chinese", "Japanese", "Mix(wrap the Chinese text with [ZH][ZH], wrap the Japanese text with [JA][JA])"],
|
142 |
+
type="index", value=language)
|
143 |
btn = gr.Button(value="Generate")
|
144 |
with gr.Row():
|
145 |
ns = gr.Slider(label="noise_scale", minimum=0.1, maximum=1.0, step=0.1, value=0.6, interactive=True)
|
|
|
153 |
download.click(None, [], [], _js=download_audio_js.format(audio_id=f"en-{name_en.replace(' ','')}"))
|
154 |
lang.change(change_lang, inputs=[lang], outputs=[ns, nsw, ls])
|
155 |
with gr.TabItem("中文"):
|
156 |
+
for (sid, name_en, name_zh, title, cover, example, language, net_g_ms, tts_fn) in models:
|
157 |
with gr.TabItem(name_zh):
|
158 |
with gr.Row():
|
159 |
gr.Markdown(
|
|
|
164 |
)
|
165 |
with gr.Row():
|
166 |
with gr.Column():
|
167 |
+
input_text = gr.Textbox(label="文本 (100字上限)", lines=5, value=example, elem_id=f"input-text-zh-{name_zh}")
|
168 |
lang = gr.Dropdown(label="语言", choices=["中文", "日语", "中日混合(中文用[ZH][ZH]包裹起来,日文用[JA][JA]包裹起来)"],
|
169 |
+
type="index", value="中文"if language == "Chinese" else "日语")
|
170 |
btn = gr.Button(value="生成")
|
171 |
with gr.Row():
|
172 |
ns = gr.Slider(label="控制感情变化程度", minimum=0.1, maximum=1.0, step=0.1, value=0.6, interactive=True)
|
pretrained_models/info.json
CHANGED
@@ -4,83 +4,107 @@
|
|
4 |
"name_zh": "白洲梓",
|
5 |
"title": "Blue Archive-白洲アズサ",
|
6 |
"cover": "cover.png",
|
7 |
-
"sid": 10
|
|
|
|
|
8 |
},
|
9 |
"alice": {
|
10 |
"name_en": "Tendou Alice",
|
11 |
"name_zh": "天童爱丽丝",
|
12 |
"title": "Blue Archive-天童アリス",
|
13 |
"cover": "cover.png",
|
14 |
-
"sid": 10
|
|
|
|
|
15 |
},
|
16 |
"hoshino": {
|
17 |
"name_en": "Takanasi Hosino",
|
18 |
"name_zh": "小鸟游星野",
|
19 |
"title": "Blue Archive-小鳥遊 ホシノ",
|
20 |
"cover": "cover.png",
|
21 |
-
"sid": 10
|
|
|
|
|
22 |
},
|
23 |
"hina": {
|
24 |
"name_en": "Sorasaki Hina",
|
25 |
"name_zh": "空崎日奈",
|
26 |
"title": "Blue Archive-空崎 ヒナ",
|
27 |
"cover": "cover.png",
|
28 |
-
"sid": 10
|
|
|
|
|
29 |
},
|
30 |
"iori": {
|
31 |
"name_en": "Shiromi Iori",
|
32 |
"name_zh": "银镜伊织",
|
33 |
"title": "Blue Archive-銀鏡イオリ",
|
34 |
"cover": "cover.png",
|
35 |
-
"sid": 10
|
|
|
|
|
36 |
},
|
37 |
"izuna": {
|
38 |
"name_en": "Kuda Izuna",
|
39 |
"name_zh": "久田泉奈",
|
40 |
"title": "Blue Archive-久田イズナ",
|
41 |
"cover": "cover.png",
|
42 |
-
"sid": 10
|
|
|
|
|
43 |
},
|
44 |
"yuuka": {
|
45 |
"name_en": "Hayase Yuuka",
|
46 |
"name_zh": "早濑优香",
|
47 |
"title": "Blue Archive-早瀬ユウカ",
|
48 |
"cover": "cover.png",
|
49 |
-
"sid": 40
|
|
|
|
|
50 |
},
|
51 |
"doom": {
|
52 |
"name_en": "Doomfist",
|
53 |
"name_zh": "末日铁拳",
|
54 |
"title": "Overwatch 2-Doomfist",
|
55 |
"cover": "cover.png",
|
56 |
-
"sid": 93
|
|
|
|
|
57 |
},
|
58 |
"echo": {
|
59 |
"name_en": "Echo",
|
60 |
"name_zh": "回声",
|
61 |
"title": "Overwatch 2-Echo",
|
62 |
"cover": "cover.png",
|
63 |
-
"sid": 93
|
|
|
|
|
64 |
},
|
65 |
"zenyatta": {
|
66 |
"name_en": "Zenyatta",
|
67 |
"name_zh": "禅雅塔",
|
68 |
"title": "Overwatch 2-Zenyatta",
|
69 |
"cover": "cover.png",
|
70 |
-
"sid": 93
|
|
|
|
|
71 |
},
|
72 |
"abyssinvoker": {
|
73 |
"name_en": "Abyss Invoker",
|
74 |
"name_zh": "深渊使徒",
|
75 |
"title": "原神-深渊使徒",
|
76 |
"cover": "cover.png",
|
77 |
-
"sid": 94
|
|
|
|
|
78 |
},
|
79 |
"keqing": {
|
80 |
"name_en": "Keqing",
|
81 |
"name_zh": "刻晴",
|
82 |
"title": "原神-刻晴",
|
83 |
"cover": "cover.png",
|
84 |
-
"sid": 115
|
|
|
|
|
85 |
}
|
86 |
}
|
|
|
4 |
"name_zh": "白洲梓",
|
5 |
"title": "Blue Archive-白洲アズサ",
|
6 |
"cover": "cover.png",
|
7 |
+
"sid": 10,
|
8 |
+
"example": "今日はいい天気ですね。",
|
9 |
+
"language": "Japanese"
|
10 |
},
|
11 |
"alice": {
|
12 |
"name_en": "Tendou Alice",
|
13 |
"name_zh": "天童爱丽丝",
|
14 |
"title": "Blue Archive-天童アリス",
|
15 |
"cover": "cover.png",
|
16 |
+
"sid": 10,
|
17 |
+
"example": "今日はいい天気ですね。",
|
18 |
+
"language": "Japanese"
|
19 |
},
|
20 |
"hoshino": {
|
21 |
"name_en": "Takanasi Hosino",
|
22 |
"name_zh": "小鸟游星野",
|
23 |
"title": "Blue Archive-小鳥遊 ホシノ",
|
24 |
"cover": "cover.png",
|
25 |
+
"sid": 10,
|
26 |
+
"example": "今日はいい天気ですね。",
|
27 |
+
"language": "Japanese"
|
28 |
},
|
29 |
"hina": {
|
30 |
"name_en": "Sorasaki Hina",
|
31 |
"name_zh": "空崎日奈",
|
32 |
"title": "Blue Archive-空崎 ヒナ",
|
33 |
"cover": "cover.png",
|
34 |
+
"sid": 10,
|
35 |
+
"example": "今日はいい天気ですね。",
|
36 |
+
"language": "Japanese"
|
37 |
},
|
38 |
"iori": {
|
39 |
"name_en": "Shiromi Iori",
|
40 |
"name_zh": "银镜伊织",
|
41 |
"title": "Blue Archive-銀鏡イオリ",
|
42 |
"cover": "cover.png",
|
43 |
+
"sid": 10,
|
44 |
+
"example": "今日はいい天気ですね。",
|
45 |
+
"language": "Japanese"
|
46 |
},
|
47 |
"izuna": {
|
48 |
"name_en": "Kuda Izuna",
|
49 |
"name_zh": "久田泉奈",
|
50 |
"title": "Blue Archive-久田イズナ",
|
51 |
"cover": "cover.png",
|
52 |
+
"sid": 10,
|
53 |
+
"example": "今日はいい天気ですね。",
|
54 |
+
"language": "Japanese"
|
55 |
},
|
56 |
"yuuka": {
|
57 |
"name_en": "Hayase Yuuka",
|
58 |
"name_zh": "早濑优香",
|
59 |
"title": "Blue Archive-早瀬ユウカ",
|
60 |
"cover": "cover.png",
|
61 |
+
"sid": 40,
|
62 |
+
"example": "今日はいい天気ですね。",
|
63 |
+
"language": "Japanese"
|
64 |
},
|
65 |
"doom": {
|
66 |
"name_en": "Doomfist",
|
67 |
"name_zh": "末日铁拳",
|
68 |
"title": "Overwatch 2-Doomfist",
|
69 |
"cover": "cover.png",
|
70 |
+
"sid": 93,
|
71 |
+
"example": "无需等待队列,并且没有长度限制",
|
72 |
+
"language": "Chinese"
|
73 |
},
|
74 |
"echo": {
|
75 |
"name_en": "Echo",
|
76 |
"name_zh": "回声",
|
77 |
"title": "Overwatch 2-Echo",
|
78 |
"cover": "cover.png",
|
79 |
+
"sid": 93,
|
80 |
+
"example": "正在复制,派蒙",
|
81 |
+
"language": "Chinese"
|
82 |
},
|
83 |
"zenyatta": {
|
84 |
"name_en": "Zenyatta",
|
85 |
"name_zh": "禅雅塔",
|
86 |
"title": "Overwatch 2-Zenyatta",
|
87 |
"cover": "cover.png",
|
88 |
+
"sid": 93,
|
89 |
+
"example": "今天晚上吃啥好呢",
|
90 |
+
"language": "Chinese"
|
91 |
},
|
92 |
"abyssinvoker": {
|
93 |
"name_en": "Abyss Invoker",
|
94 |
"name_zh": "深渊使徒",
|
95 |
"title": "原神-深渊使徒",
|
96 |
"cover": "cover.png",
|
97 |
+
"sid": 94,
|
98 |
+
"example": "今天晚上吃啥好呢",
|
99 |
+
"language": "Chinese"
|
100 |
},
|
101 |
"keqing": {
|
102 |
"name_en": "Keqing",
|
103 |
"name_zh": "刻晴",
|
104 |
"title": "原神-刻晴",
|
105 |
"cover": "cover.png",
|
106 |
+
"sid": 115,
|
107 |
+
"example": "今天晚上吃啥好呢",
|
108 |
+
"language": "Chinese"
|
109 |
}
|
110 |
}
|