File size: 7,590 Bytes
20d05ae
 
925d97e
 
 
 
 
 
 
 
 
20d05ae
8dc2b8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
613930c
 
 
e3deb88
 
613930c
 
80a2de5
9965f6c
 
80a2de5
613930c
774c3fb
 
 
20bf74d
774c3fb
 
20bf74d
613930c
 
eb3ba2e
8dc2b8f
13ec671
5e1f660
03bff01
0cb3834
 
03bff01
0cb3834
613930c
0cb3834
 
9031563
 
03bff01
 
 
 
0cb3834
 
 
03bff01
0cb3834
613930c
0cb3834
8dc2b8f
 
 
 
 
e3deb88
8dc2b8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80a2de5
90d557d
 
 
 
 
 
 
 
80a2de5
20d05ae
eb927b7
 
1
2
3
4
5
6
7
8
9
10
11
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
import gradio as gr
import os
from constants import VOICE_METHODS, BARK_VOICES, EDGE_VOICES
import platform
from models.model import *
from tts.conversion import COQUI_LANGUAGES
import pytube
import os
import traceback
from pydub import AudioSegment
# from audio_enhance.functions import audio_enhance

import ast
import argparse
import glob
import pickle

import numpy as np
import pandas as pd
block_css = """
#notice_markdown {
    font-size: 104%
}
#notice_markdown th {
    display: none;
}
#notice_markdown td {
    padding-top: 6px;
    padding-bottom: 6px;
}
#leaderboard_markdown {
    font-size: 104%
}
#leaderboard_markdown td {
    padding-top: 6px;
    padding-bottom: 6px;
}
#leaderboard_dataframe td {
    line-height: 0.1em;
}
footer {
    display:none !important
}
.image-container {
    display: flex;
    align-items: center;
    padding: 1px;
}
.image-container img {
    margin: 0 30px;
    height: 20px;
    max-height: 100%;
    width: auto;
    max-width: 20%;
}
"""
def model_hyperlink(model_name, link):
    return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
def load_leaderboard_table_csv(filename, add_hyperlink=True):
    lines = open(filename).readlines()
    heads = [v.strip() for v in lines[0].split(",")]
    rows = []
    for i in range(1, len(lines)):
        row = [v.strip() for v in lines[i].split(",")]
        for j in range(len(heads)):
            item = {}
            for h, v in zip(heads, row):
                if h != "AI歌手名/AI Singer" and h != "歌手代表作或介绍链接" and h != "模型zip链接/Link to Model Zip File" and h != "模型贡献者/Model Contributor":
                    item[h] = int(v)
                else:
                    item[h] = v
            if add_hyperlink:
                item["AI歌手名/AI Singer"] = model_hyperlink(item["AI歌手名/AI Singer"], item["歌手代表作或介绍链接"])
        rows.append(item)
    return rows

def get_arena_table(model_table_df):
    # sort by rating
    model_table_df = model_table_df.sort_values(by=["训练素材时长/Duration of Training Dataset(min)"], ascending=False)
    values = []
    for i in range(len(model_table_df)):
        row = []
        model_key = model_table_df.index[i]
        model_name = model_table_df["AI歌手名/AI Singer"].values[model_key]
        # rank
        row.append(i + 1)
        # model display name
        row.append(model_name)

        row.append(
            model_table_df["模型zip链接/Link to Model Zip File"].values[model_key]
        )

        row.append(
            model_table_df["训练素材时长/Duration of Training Dataset(min)"].values[model_key]
        )

        row.append(
            model_table_df["训练epoch数/Epoch"].values[model_key]
        )

        row.append(
            model_table_df["模型贡献者/Model Contributor"].values[model_key]
        )

        values.append(row)
    return values



title_markdown = ("""
<h2 align="center"> 🌊💕🎶 滔滔AI,AI歌手模型开源社区 </h2>
<h3 align="center"> 🌟 完全开源、完全免费、共建共享!全网AI歌手任您选择! </h3>
""")

pic_markdown = ("""
<h3 align="center">  </h3>
<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>
""")


data = load_leaderboard_table_csv("./OCRBench.csv")
model_table_df = pd.DataFrame(data)
text_size = gr.themes.sizes.text_lg


with gr.Blocks(theme=gr.themes.Base(text_size=text_size), css=block_css) as app:
    
    gr.Markdown(title_markdown)

    with gr.Tab("✨模型搜索及上传"):
        gr.HTML("<h3>1. 搜索AI歌手模型</h3>")
        gr.Markdown("##### 点击[此链接](https://docs.google.com/spreadsheets/d/1owfUtQuLW9ReiIwg6U9UkkDmPOTkuNHf0OKQtWu1iaI/edit?gid=1227575351#gid=1227575351),查看全网所有开源AI歌手模型,超9000个模型任您挑选 🥳")
        search_name = gr.Textbox(placeholder="孙燕姿", label="请填写模型名称进行搜索", show_label=True)
         # Salida
        with gr.Row():
            sarch_output = gr.Markdown(label="搜索结果")
            
        btn_search_model = gr.Button(value="开始搜索吧💖", variant="primary")
        btn_search_model.click(fn=search_model, inputs=[search_name], outputs=[sarch_output])
        
        gr.HTML("<h3>2. 上传AI歌手模型至社区</h3>")
        gr.HTML("<h4>上传完成后您立即可以搜索到您上传的模型</h4>")
        post_name = gr.Textbox(placeholder="滔滔歌姬", label="请填写模型名称", show_label=True)
        post_model_url = gr.Textbox(placeholder="https://huggingface.co/kevinwang676/RVC-models/resolve/main/talktalkgirl.zip", label="模型链接", info="1.推荐使用Hugging Face存放模型 2.复制Hugging Face模型链接后,需要将链接中的blob四个字母替换成resolve,使模型可以通过链接直接下载", show_label=True)
        post_creator = gr.Textbox(placeholder="滔滔AI", label="模型贡献者", info="可填写您的昵称或任何有趣的ID", show_label=True)
        post_version = gr.Dropdown(choices=["RVC v1", "RVC v2"], value="RVC v2", label="RVC模型版本", show_label=True)
        
         # Salida
        with gr.Row():
            post_output = gr.Markdown(label="模型上传状态")
            
        btn_post_model = gr.Button(value="开始上传吧💕", variant="primary")
        btn_post_model.click(fn=post_model, inputs=[post_name, post_model_url, post_version, post_creator], outputs=[post_output])

    with gr.Tab("🍻滔滔AI精选模型"):
        arena_table_vals = get_arena_table(model_table_df)
        md = """
        AI翻唱🎶:您可以在社区中复制您喜欢的AI歌手的“模型zip链接”,之后就可以在“🌟重磅首发 - AI歌手全明星💕”页面中通过粘贴zip链接来使用您喜欢的AI歌手模型啦!\n
        [手机端📱](https://g-app-center-40055665-0593-xqmmjg6.openxlab.space)查看 滔滔AI精选模型
        """
        gr.Markdown(md, elem_id="leaderboard_markdown")
        gr.Dataframe(
            headers=[
                "排序",
                "AI歌手名/AI Singer",
                "模型zip链接/Link to Model Zip File",
                "训练素材时长/Duration of Training Dataset(min)",
                "训练epoch数/Epoch",
                "模型贡献者/Model Contributor",
            ],
            datatype=[
                "str",
                "markdown",
                "str",
                "number",
                "number",
                "str",
            ],
            value=arena_table_vals,
            elem_id="arena_leaderboard_dataframe",
            height=800,
            column_widths=[50, 100, 205, 95, 95, 95],
            wrap=True,
        )

    gr.Markdown(pic_markdown)
    gr.Markdown("###### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。请自觉合规使用此程序,程序开发者不负有任何责任。</center>")

    gr.HTML('''
        <div class="footer">
                    <p>🌊🏞️🎶 - 江水东流急,滔滔无尽声。 明·顾璘
                    </p>
        </div>
    ''')
   
    
    app.queue(max_size=40, api_open=False)
    app.launch(max_threads=400, show_error=True)