Spaces:
Runtime error
Runtime error
candlend
commited on
Commit
•
bfaaeb5
1
Parent(s):
7d01d2d
device cuda; modify header
Browse files- app.py +7 -8
- header.html +4 -4
app.py
CHANGED
@@ -14,10 +14,11 @@ from text import text_to_sequence
|
|
14 |
import gradio as gr
|
15 |
|
16 |
|
17 |
-
pth_path = "
|
|
|
18 |
hps = utils.get_hparams_from_file("./configs/hoshimi_base.json")
|
19 |
-
|
20 |
-
device = torch.device("cpu")
|
21 |
|
22 |
def get_text(text, hps):
|
23 |
text_norm = text_to_sequence(text, hps.data.text_cleaners)
|
@@ -47,8 +48,6 @@ def list_model():
|
|
47 |
continue
|
48 |
if (f.endswith(".pth")):
|
49 |
res.append(f)
|
50 |
-
if len(f) >= len(pth_path):
|
51 |
-
pth_path = f
|
52 |
return res
|
53 |
|
54 |
|
@@ -66,9 +65,9 @@ net_g = load_model(pth_path)
|
|
66 |
|
67 |
def change_model(model):
|
68 |
global pth_path
|
69 |
-
global
|
70 |
pth_path = model
|
71 |
-
|
72 |
return "载入模型:"+pth_path
|
73 |
|
74 |
|
@@ -83,7 +82,7 @@ with app:
|
|
83 |
tts_input1 = gr.TextArea(
|
84 |
label="请输入文本(目前只支持汉字和单个英文字母,也可以使用逗号、句号、感叹号、空格等常用符号来改变语调和停顿)",
|
85 |
value="这里是爱喝奶茶,穿得也像奶茶魅力点是普通话二乙的星弥吼西咪,晚上齁。")
|
86 |
-
tts_submit = gr.Button("
|
87 |
tts_output = gr.Audio(label="Output")
|
88 |
tts_model = gr.Markdown("")
|
89 |
tts_submit.click(infer, [tts_input1], [tts_output])
|
|
|
14 |
import gradio as gr
|
15 |
|
16 |
|
17 |
+
pth_path = os.path.basename(utils.latest_checkpoint_path("./", "G_*.pth"))
|
18 |
+
# pth_path = "G_250000.pth"
|
19 |
hps = utils.get_hparams_from_file("./configs/hoshimi_base.json")
|
20 |
+
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
21 |
+
# device = torch.device("cpu")
|
22 |
|
23 |
def get_text(text, hps):
|
24 |
text_norm = text_to_sequence(text, hps.data.text_cleaners)
|
|
|
48 |
continue
|
49 |
if (f.endswith(".pth")):
|
50 |
res.append(f)
|
|
|
|
|
51 |
return res
|
52 |
|
53 |
|
|
|
65 |
|
66 |
def change_model(model):
|
67 |
global pth_path
|
68 |
+
global net_g
|
69 |
pth_path = model
|
70 |
+
net_g = load_model(pth_path)
|
71 |
return "载入模型:"+pth_path
|
72 |
|
73 |
|
|
|
82 |
tts_input1 = gr.TextArea(
|
83 |
label="请输入文本(目前只支持汉字和单个英文字母,也可以使用逗号、句号、感叹号、空格等常用符号来改变语调和停顿)",
|
84 |
value="这里是爱喝奶茶,穿得也像奶茶魅力点是普通话二乙的星弥吼西咪,晚上齁。")
|
85 |
+
tts_submit = gr.Button("合成", variant="primary")
|
86 |
tts_output = gr.Audio(label="Output")
|
87 |
tts_model = gr.Markdown("")
|
88 |
tts_submit.click(infer, [tts_input1], [tts_output])
|
header.html
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<div
|
2 |
-
style="width: 100%;padding-top:116px;background-image: url('https://huggingface.co/spaces/candlend/vits-hoshimi/resolve/main/header.png')
|
3 |
<div>
|
4 |
<div style="margin: 0px 20px;display: flex;">
|
5 |
<div class="bili-avatar" style="padding-top: 20px;">
|
@@ -9,12 +9,12 @@
|
|
9 |
</a>
|
10 |
</div>
|
11 |
<div style="margin:20px;color:white">
|
12 |
-
<div style="align-items: flex-end;display: flex">
|
13 |
-
<span style="font-size:20px;min-width:85px;color:
|
14 |
<img style="padding-left: 3px;" title="粉丝数"
|
15 |
src="https://img.shields.io/badge/dynamic/json?color=orange&label=%E7%B2%89%E4%B8%9D%E6%95%B0&query=data.follower&url=https%3A%2F%2Fapi.bilibili.com%2Fx%2Frelation%2Fstat%3Fvmid%3D477342747"></img>
|
16 |
<img style="padding-left: 5px;"
|
17 |
-
src="https://img.shields.io/badge/
|
18 |
title="五期生"></img>
|
19 |
</div>
|
20 |
</div>
|
|
|
1 |
<div
|
2 |
+
style="width: 100%;padding-top:116px;background-image: url('https://huggingface.co/spaces/candlend/vits-hoshimi/resolve/main/header.png');background-size:cover;background-position:right;">
|
3 |
<div>
|
4 |
<div style="margin: 0px 20px;display: flex;">
|
5 |
<div class="bili-avatar" style="padding-top: 20px;">
|
|
|
9 |
</a>
|
10 |
</div>
|
11 |
<div style="margin:20px;color:white">
|
12 |
+
<div style="align-items: flex-end; display: flex">
|
13 |
+
<span style="font-size:20px;min-width:85px;color:black">星弥Hoshimi</span>
|
14 |
<img style="padding-left: 3px;" title="粉丝数"
|
15 |
src="https://img.shields.io/badge/dynamic/json?color=orange&label=%E7%B2%89%E4%B8%9D%E6%95%B0&query=data.follower&url=https%3A%2F%2Fapi.bilibili.com%2Fx%2Frelation%2Fstat%3Fvmid%3D477342747"></img>
|
16 |
<img style="padding-left: 5px;"
|
17 |
+
src="https://img.shields.io/badge/VR-%E4%BA%94%E6%9C%9F%E7%94%9F-orange"
|
18 |
title="五期生"></img>
|
19 |
</div>
|
20 |
</div>
|