Mahiruoshi
commited on
Commit
•
0bc5811
1
Parent(s):
8c892cf
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import romajitable
|
2 |
import re
|
3 |
import numpy as np
|
@@ -161,16 +193,17 @@ app = gr.Blocks()
|
|
161 |
with app:
|
162 |
with gr.Tabs():
|
163 |
|
164 |
-
with gr.TabItem("虹团vits
|
165 |
|
166 |
tts_input1 = gr.TextArea(label="去标贝新模型,老版本在lovelive文件夹中", value="数千怀言者已经为你集结,列队在通往主舰桥的过道上。他们歌唱着你们名字,高声呼喊,以一种原始的、咆哮般的合唱作为对你的致敬。你从他们中间走过,一边点头,一边接受他们的赞美,你沉溺其中,几乎被他们巨大的音量所震撼。\n他们之中没有一个胆敢直视你。没有一个能够承受。你对他们超人类的眼睛来说都太过光辉。从他们中间走过时,你巨大的影子从他们身上掠过,他们立时将目光挪开,眼含泪水,吟诵你的大名时甚至不敢看你一眼。他们的吟唱中含有愤怒。几乎是疯狂的绝望。那感觉就好像他们害怕停下来,害怕自己会喘息停顿,好像尖叫出你的名字是唯一能让他们活着的事情。\n或许确实如此。作为对他们崇拜的回应,你谦虚地抬抬手,随后走进主舰桥。\nI In a word, Horus is a joker.")
|
167 |
language = gr.Dropdown(label="选择语言,目前勉强可以做到自动识别",choices=lan, value="自动", interactive=True)
|
168 |
-
para_input1 = gr.Slider(minimum= 0.01,maximum=1.0,label="
|
169 |
-
para_input2 = gr.Slider(minimum= 0.01,maximum=1.0,label="
|
170 |
para_input3 = gr.Slider(minimum= 0.1,maximum=10,label="更改时间比例", value=1)
|
171 |
tts_submit = gr.Button("Generate", variant="primary")
|
172 |
speaker1 = gr.Dropdown(label="选择说话人",choices=idols, value="歩夢", interactive=True)
|
173 |
tts_output2 = gr.Audio(label="Output")
|
174 |
tts_submit.click(infer, [language,tts_input1,speaker1,para_input1,para_input2,para_input3], [tts_output2])
|
175 |
#app.launch(share=True)
|
176 |
-
app.launch()
|
|
|
|
1 |
+
import ONNXVITS_models
|
2 |
+
import utils
|
3 |
+
from text import text_to_sequence
|
4 |
+
import torch
|
5 |
+
import commons
|
6 |
+
|
7 |
+
def get_text(text, hps):
|
8 |
+
text_norm = text_to_sequence(text, hps.symbols, hps.data.text_cleaners)
|
9 |
+
if hps.data.add_blank:
|
10 |
+
text_norm = commons.intersperse(text_norm, 0)
|
11 |
+
text_norm = torch.LongTensor(text_norm)
|
12 |
+
return text_norm
|
13 |
+
|
14 |
+
hps = utils.get_hparams_from_file("lovelive/config.json")
|
15 |
+
symbols = hps.symbols
|
16 |
+
net_g = ONNXVITS_models.SynthesizerTrn(
|
17 |
+
len(symbols),
|
18 |
+
hps.data.filter_length // 2 + 1,
|
19 |
+
hps.train.segment_size // hps.data.hop_length,
|
20 |
+
n_speakers=hps.data.n_speakers,
|
21 |
+
**hps.model)
|
22 |
+
_ = net_g.eval()
|
23 |
+
_ = utils.load_checkpoint("lovelive/G_525000.pth", net_g)
|
24 |
+
|
25 |
+
text1 = get_text("[JA]ありがとうございます。[JA]", hps)
|
26 |
+
stn_tst = text1
|
27 |
+
with torch.no_grad():
|
28 |
+
x_tst = stn_tst.unsqueeze(0)
|
29 |
+
x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
|
30 |
+
sid = torch.tensor([0])
|
31 |
+
o = net_g(x_tst, x_tst_lengths, sid=sid, noise_scale=.667, noise_scale_w=0.8, length_scale=1)
|
32 |
+
'''
|
33 |
import romajitable
|
34 |
import re
|
35 |
import numpy as np
|
|
|
193 |
with app:
|
194 |
with gr.Tabs():
|
195 |
|
196 |
+
with gr.TabItem("虹团vits模型,现可按句分割实现长文本合成,onnx导出后存在质量损失,建议本地运行vits模型"):
|
197 |
|
198 |
tts_input1 = gr.TextArea(label="去标贝新模型,老版本在lovelive文件夹中", value="数千怀言者已经为你集结,列队在通往主舰桥的过道上。他们歌唱着你们名字,高声呼喊,以一种原始的、咆哮般的合唱作为对你的致敬。你从他们中间走过,一边点头,一边接受他们的赞美,你沉溺其中,几乎被他们巨大的音量所震撼。\n他们之中没有一个胆敢直视你。没有一个能够承受。你对他们超人类的眼睛来说都太过光辉。从他们中间走过时,你巨大的影子从他们身上掠过,他们立时将目光挪开,眼含泪水,吟诵你的大名时甚至不敢看你一眼。他们的吟唱中含有愤怒。几乎是疯狂的绝望。那感觉就好像他们害怕停下来,害怕自己会喘息停顿,好像尖叫出你的名字是唯一能让他们活着的事情。\n或许确实如此。作为对他们崇拜的回应,你谦虚地抬抬手,随后走进主舰桥。\nI In a word, Horus is a joker.")
|
199 |
language = gr.Dropdown(label="选择语言,目前勉强可以做到自动识别",choices=lan, value="自动", interactive=True)
|
200 |
+
para_input1 = gr.Slider(minimum= 0.01,maximum=1.0,label="更改噪声比例,以控制情感", value=0.667)
|
201 |
+
para_input2 = gr.Slider(minimum= 0.01,maximum=1.0,label="更改噪声偏差,以控制音素长短", value=0.7)
|
202 |
para_input3 = gr.Slider(minimum= 0.1,maximum=10,label="更改时间比例", value=1)
|
203 |
tts_submit = gr.Button("Generate", variant="primary")
|
204 |
speaker1 = gr.Dropdown(label="选择说话人",choices=idols, value="歩夢", interactive=True)
|
205 |
tts_output2 = gr.Audio(label="Output")
|
206 |
tts_submit.click(infer, [language,tts_input1,speaker1,para_input1,para_input2,para_input3], [tts_output2])
|
207 |
#app.launch(share=True)
|
208 |
+
app.launch()
|
209 |
+
'''
|