Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -10,38 +10,102 @@ import traceback
|
|
10 |
from pydub import AudioSegment
|
11 |
# from audio_enhance.functions import audio_enhance
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
|
47 |
title_markdown = ("""
|
@@ -54,11 +118,11 @@ pic_markdown = ("""
|
|
54 |
<h1 align="center"><a href="https://www.talktalkai.com/"><img src="https://download.openxlab.org.cn/models/Kevin676/rvc-models/weight/talktalkai-cover.png", alt="talktalkai-cover" border="0" style="margin: 0 auto; height: 300px;" /></a> </h1>
|
55 |
""")
|
56 |
|
57 |
-
with gr.Blocks() as app:
|
58 |
|
59 |
gr.Markdown(title_markdown)
|
60 |
|
61 |
-
with gr.Tab("
|
62 |
gr.HTML("<h3>1. 搜索AI歌手模型</h3>")
|
63 |
gr.Markdown("##### 点击[此链接](https://docs.google.com/spreadsheets/d/1owfUtQuLW9ReiIwg6U9UkkDmPOTkuNHf0OKQtWu1iaI/edit?gid=1227575351#gid=1227575351),查看全网所有开源AI歌手模型,超9000个模型任您挑选 🥳")
|
64 |
search_name = gr.Textbox(placeholder="孙燕姿", label="请填写模型名称进行搜索", show_label=True)
|
@@ -82,7 +146,38 @@ with gr.Blocks() as app:
|
|
82 |
|
83 |
btn_post_model = gr.Button(value="开始上传吧💕", variant="primary")
|
84 |
btn_post_model.click(fn=post_model, inputs=[post_name, post_model_url, post_version, post_creator], outputs=[post_output])
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
gr.Markdown(pic_markdown)
|
87 |
gr.Markdown("###### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。请自觉合规使用此程序,程序开发者不负有任何责任。</center>")
|
88 |
|
|
|
10 |
from pydub import AudioSegment
|
11 |
# from audio_enhance.functions import audio_enhance
|
12 |
|
13 |
+
import ast
|
14 |
+
import argparse
|
15 |
+
import glob
|
16 |
+
import pickle
|
17 |
+
|
18 |
+
import numpy as np
|
19 |
+
import pandas as pd
|
20 |
+
block_css = """
|
21 |
+
#notice_markdown {
|
22 |
+
font-size: 104%
|
23 |
+
}
|
24 |
+
#notice_markdown th {
|
25 |
+
display: none;
|
26 |
+
}
|
27 |
+
#notice_markdown td {
|
28 |
+
padding-top: 6px;
|
29 |
+
padding-bottom: 6px;
|
30 |
+
}
|
31 |
+
#leaderboard_markdown {
|
32 |
+
font-size: 104%
|
33 |
+
}
|
34 |
+
#leaderboard_markdown td {
|
35 |
+
padding-top: 6px;
|
36 |
+
padding-bottom: 6px;
|
37 |
+
}
|
38 |
+
#leaderboard_dataframe td {
|
39 |
+
line-height: 0.1em;
|
40 |
+
}
|
41 |
+
footer {
|
42 |
+
display:none !important
|
43 |
+
}
|
44 |
+
.image-container {
|
45 |
+
display: flex;
|
46 |
+
align-items: center;
|
47 |
+
padding: 1px;
|
48 |
+
}
|
49 |
+
.image-container img {
|
50 |
+
margin: 0 30px;
|
51 |
+
height: 20px;
|
52 |
+
max-height: 100%;
|
53 |
+
width: auto;
|
54 |
+
max-width: 20%;
|
55 |
+
}
|
56 |
+
"""
|
57 |
+
def model_hyperlink(model_name, link):
|
58 |
+
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
59 |
+
def load_leaderboard_table_csv(filename, add_hyperlink=True):
|
60 |
+
lines = open(filename).readlines()
|
61 |
+
heads = [v.strip() for v in lines[0].split(",")]
|
62 |
+
rows = []
|
63 |
+
for i in range(1, len(lines)):
|
64 |
+
row = [v.strip() for v in lines[i].split(",")]
|
65 |
+
for j in range(len(heads)):
|
66 |
+
item = {}
|
67 |
+
for h, v in zip(heads, row):
|
68 |
+
if h != "AI歌手名/AI Singer" and h != "歌手代表作或介绍链接" and h != "模型zip链接/Link to Model Zip File" and h != "模型贡献者/Model Contributor":
|
69 |
+
item[h] = int(v)
|
70 |
+
else:
|
71 |
+
item[h] = v
|
72 |
+
if add_hyperlink:
|
73 |
+
item["AI歌手名/AI Singer"] = model_hyperlink(item["AI歌手名/AI Singer"], item["歌手代表作或介绍链接"])
|
74 |
+
rows.append(item)
|
75 |
+
return rows
|
76 |
+
|
77 |
+
def get_arena_table(model_table_df):
|
78 |
+
# sort by rating
|
79 |
+
model_table_df = model_table_df.sort_values(by=["训练素材时长/Duration of Training Dataset(min)"], ascending=False)
|
80 |
+
values = []
|
81 |
+
for i in range(len(model_table_df)):
|
82 |
+
row = []
|
83 |
+
model_key = model_table_df.index[i]
|
84 |
+
model_name = model_table_df["AI歌手名/AI Singer"].values[model_key]
|
85 |
+
# rank
|
86 |
+
row.append(i + 1)
|
87 |
+
# model display name
|
88 |
+
row.append(model_name)
|
89 |
+
|
90 |
+
row.append(
|
91 |
+
model_table_df["模型zip链接/Link to Model Zip File"].values[model_key]
|
92 |
+
)
|
93 |
+
|
94 |
+
row.append(
|
95 |
+
model_table_df["训练素材时长/Duration of Training Dataset(min)"].values[model_key]
|
96 |
+
)
|
97 |
+
|
98 |
+
row.append(
|
99 |
+
model_table_df["训练epoch数/Epoch"].values[model_key]
|
100 |
+
)
|
101 |
+
|
102 |
+
row.append(
|
103 |
+
model_table_df["模型贡献者/Model Contributor"].values[model_key]
|
104 |
+
)
|
105 |
+
|
106 |
+
values.append(row)
|
107 |
+
return values
|
108 |
+
|
109 |
|
110 |
|
111 |
title_markdown = ("""
|
|
|
118 |
<h1 align="center"><a href="https://www.talktalkai.com/"><img src="https://download.openxlab.org.cn/models/Kevin676/rvc-models/weight/talktalkai-cover.png", alt="talktalkai-cover" border="0" style="margin: 0 auto; height: 300px;" /></a> </h1>
|
119 |
""")
|
120 |
|
121 |
+
with gr.Blocks(theme="JohnSmith9982/small_and_pretty", css=block_css) as app:
|
122 |
|
123 |
gr.Markdown(title_markdown)
|
124 |
|
125 |
+
with gr.Tab("✨模型搜索及上传"):
|
126 |
gr.HTML("<h3>1. 搜索AI歌手模型</h3>")
|
127 |
gr.Markdown("##### 点击[此链接](https://docs.google.com/spreadsheets/d/1owfUtQuLW9ReiIwg6U9UkkDmPOTkuNHf0OKQtWu1iaI/edit?gid=1227575351#gid=1227575351),查看全网所有开源AI歌手模型,超9000个模型任您挑选 🥳")
|
128 |
search_name = gr.Textbox(placeholder="孙燕姿", label="请填写模型名称进行搜索", show_label=True)
|
|
|
146 |
|
147 |
btn_post_model = gr.Button(value="开始上传吧💕", variant="primary")
|
148 |
btn_post_model.click(fn=post_model, inputs=[post_name, post_model_url, post_version, post_creator], outputs=[post_output])
|
149 |
+
|
150 |
+
with gr.Tab("🍻滔滔AI精选模型"):
|
151 |
+
arena_table_vals = get_arena_table(model_table_df)
|
152 |
+
md = """
|
153 |
+
AI翻唱🎶:您可以在社区中复制您喜欢的AI歌手的“模型zip链接”,之后就可以在“🌟重磅首发 - AI歌手全明星💕”页面中通过粘贴zip链接来使用您喜欢的AI歌手模型啦!\n
|
154 |
+
[手机端📱](https://kevinwang676-talktalkai-models.hf.space)查看滔滔AI精选模型
|
155 |
+
"""
|
156 |
+
gr.Markdown(md, elem_id="leaderboard_markdown")
|
157 |
+
gr.Dataframe(
|
158 |
+
headers=[
|
159 |
+
"排序",
|
160 |
+
"AI歌手名/AI Singer",
|
161 |
+
"模型zip链接/Link to Model Zip File",
|
162 |
+
"训练素材时长/Duration of Training Dataset(min)",
|
163 |
+
"训练epoch数/Epoch",
|
164 |
+
"模型贡献者/Model Contributor",
|
165 |
+
],
|
166 |
+
datatype=[
|
167 |
+
"str",
|
168 |
+
"markdown",
|
169 |
+
"str",
|
170 |
+
"number",
|
171 |
+
"number",
|
172 |
+
"str",
|
173 |
+
],
|
174 |
+
value=arena_table_vals,
|
175 |
+
elem_id="arena_leaderboard_dataframe",
|
176 |
+
height=800,
|
177 |
+
column_widths=[50, 100, 205, 95, 95, 95],
|
178 |
+
wrap=True,
|
179 |
+
)
|
180 |
+
|
181 |
gr.Markdown(pic_markdown)
|
182 |
gr.Markdown("###### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。请自觉合规使用此程序,程序开发者不负有任何责任。</center>")
|
183 |
|