Spaces:
Sleeping
Sleeping
File size: 26,985 Bytes
c5ed230 b5830b6 d94ccbe b5830b6 d94ccbe b5830b6 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe b5830b6 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe b5830b6 d94ccbe dc13618 b5830b6 d94ccbe dc13618 d94ccbe dc13618 d94ccbe b5830b6 dc13618 d94ccbe 52289ee b5830b6 4d95c1f d94ccbe b5830b6 d94ccbe b5830b6 dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe b5830b6 dc13618 b5830b6 dc13618 b5830b6 dc13618 b5830b6 dc13618 b5830b6 dc13618 b5830b6 dc13618 d94ccbe dc13618 d94ccbe dc13618 d94ccbe b5830b6 dc13618 ff648e9 dc13618 b5830b6 dc13618 b5830b6 dc13618 d94ccbe dc13618 d94ccbe dc13618 b5830b6 dc13618 b5830b6 d94ccbe dc13618 d94ccbe dc13618 b5830b6 92fbafd |
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>vits-simple-api</title>
<link rel="stylesheet" href="/static/css/style.css">
<link rel="stylesheet" href="/static/css/bootstrap.min.css"/>
</head>
<body>
<main class="main-container">
<div class="container flex flex-wrap mx-auto">
<div class="text-center d-flex align-items-center w-100" style="height: 100px;" id="component-1">
<h1 class="w-100">
<a href="https://github.com/Artrajz/vits-simple-api" target="_blank"
style="text-decoration: none; color: black"> vits-simple-api </a>
</h1>
</div>
<div class="tabs w-100 border-b-2" id="component-2">
<button class="tab-button px-4 pb-2 pt-2 active " onclick="showContent(0)">VITS</button>
<button class="tab-button px-4 pb-2 pt-2" onclick="showContent(1)">W2V2-VITS</button>
<button class="tab-button px-4 pb-2 pt-2" onclick="showContent(2)">Bert-VITS2</button>
</div>
<div class="content w-100 border-lr-2 border-b-2" id="component-3">
<div class="content-pane active w-100 flex-wrap">
<form class="w-100">
<div class="form-group">
<label>text</label>
<textarea class="form-control" id="input_text1" rows="3"
oninput="updateLink()">你好,こんにちは</textarea>
</div>
<div class="form-group">
<label>id</label>
<select class="form-control" id="input_id1" oninput="updateLink()">
{% for speaker in speakers["VITS"] %}
<option value="{{ speaker["id"] }}">{{ speaker["id"] }} | {{ speaker["name"] }}
| {{ speaker["lang"] }}</option>
{% endfor %}
{% if vits_speakers_count <=0 %}
<option value="" disabled selected hidden>未加载模型</option>
{% endif %}
</select>
</div>
</form>
<form class="w-100">
<div class="row">
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="默认为wav">format</label>
<select class="form-control" id="input_format1" oninput="updateLink()">
<option></option>
<option>wav</option>
<option>mp3</option>
<option>ogg</option>
<option>silk</option>
<option>flac</option>
</select>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="自动识别语言auto:可识别的语言根据不同speaker而不同,方言无法自动识别。方言模型需要手动指定语言,比如粤语Cantonese要指定参数lang=gd">lang</label>
<input type="text" class="form-control" id="input_lang1" oninput="updateLink()" value=""
placeholder="auto"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="调节语音长度,相当于调节语速,该数值越大语速越慢。">length</label>
<input type="number" class="form-control" id="input_length1" oninput="updateLink()" value=""
placeholder="1" min="0" step="0.001"/>
</div>
</div>
<div class="row">
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="样本噪声,控制合成的随机性。">noise</label>
<input type="number" class="form-control" id="input_noise1" oninput="updateLink()" value=""
placeholder="0.33" min="0" step="0.001"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="随机时长预测器噪声,控制音素发音长度。">noisew</label>
<input type="number" class="form-control" id="input_noisew1" oninput="updateLink()" value=""
placeholder="0.4" min="0" step="0.001"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="按标点符号分段,加起来大于max时为一段文本。max<=0表示不分段。">max</label>
<input type="number" class="form-control" id="input_max1" oninput="updateLink()" value=""
placeholder="50" step="1"/>
</div>
</div>
</form>
<div class="flex flex-wrap w-100"
style="justify-content: center; align-items: center; height: 80px; margin-top: 20px; margin-bottom: 20px; border: 1px solid rgba(0,0,0,.125); border-radius: 0.25rem;">
<button type="button" class="btn btn-outline-secondary" onclick="setAudioSource()"
style="margin-right: 10px">
播放器生成
</button>
<audio id="audioPlayer1" controls>
<source src="" type="audio/mp3"/>
Your browser does not support the audio element.
</audio>
<div class="form-group form-check">
<input type="checkbox" id="streaming1" onchange="updateLink()">
<label class="form-check-label" data-toggle="tooltip" data-placement="top"
title="按照max分段推理文本,推理好一段即输出,无需等待所有文本都推理完毕">流式响应</label>
</div>
</div>
</div>
<div class="content-pane w-100 flex-wrap">
<form class="w-100">
<div class="form-group">
<label>text</label>
<textarea class="form-control" id="input_text2" rows="3"
oninput="updateLink()">你好,こんにちは</textarea>
</div>
<div class="form-group">
<label>id</label>
<select class="form-control" id="input_id2" oninput="updateLink()">
{% for speaker in speakers["W2V2-VITS"] %}
<option value="{{ speaker["id"] }}">{{ speaker["id"] }} | {{ speaker["name"] }}
| {{ speaker["lang"] }}</option>
{% endfor %}
{% if w2v2_speakers_count <=0 %}
<option value="" disabled selected hidden>未加载模型</option>
{% endif %}
</select>
</div>
<div class="form-group mb-3">
<label data-toggle="tooltip" data-placement="top"
title="情感嵌入,{% if w2v2_emotion_count > 0 %}
可输入范围是0-{{ w2v2_emotion_count-1 }}
{% else %}
未加载emotion
{% endif %}">emotion</label>
<input type="number" class="form-control" min="0" max="{{ w2v2_emotion_count-1 }}" step="1"
id="emotion" value="0" oninput="updateLink()">
</div>
</form>
<form class="w-100">
<div class="row">
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="默认为wav">format</label>
<select class="form-control" id="input_format2" oninput="updateLink()">
<option></option>
<option>wav</option>
<option>mp3</option>
<option>ogg</option>
<option>silk</option>
<option>flac</option>
</select>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="自动识别语言auto:可识别的语言根据不同speaker而不同,方言无法自动识别。方言模型需要手动指定语言,比如粤语Cantonese要指定参数lang=gd">lang</label>
<input type="text" class="form-control" id="input_lang2" oninput="updateLink()" value=""
placeholder="auto"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="调节语音长度,相当于调节语速,该数值越大语速越慢。">length</label>
<input type="number" class="form-control" id="input_length2" oninput="updateLink()" value=""
placeholder="1" min="0" step="0.001"/>
</div>
</div>
<div class="row">
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="样本噪声,控制合成的随机性。">noise</label>
<input type="number" class="form-control" id="input_noise2" oninput="updateLink()" value=""
placeholder="0.33" min="0" step="0.001"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="随机时长预测器噪声,控制音素发音长度。">noisew</label>
<input type="number" class="form-control" id="input_noisew2" oninput="updateLink()" value=""
placeholder="0.4" min="0" step="0.001"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="按标点符号分段,加起来大于max时为一段文本。max<=0表示不分段。">max</label>
<input type="number" class="form-control" id="input_max2" oninput="updateLink()" value=""
placeholder="50" step="1"/>
</div>
</div>
</form>
<div class="flex flex-wrap w-100"
style="justify-content: center; align-items: center; height: 80px; margin-top: 20px; margin-bottom: 20px; border: 1px solid rgba(0,0,0,.125); border-radius: 0.25rem;">
<button type="button" class="btn btn-outline-secondary" onclick="setAudioSource()"
style="margin-right: 10px">
播放器生成
</button>
<audio id="audioPlayer2" controls>
<source src="" type="audio/mp3"/>
Your browser does not support the audio element.
</audio>
</div>
</div>
<div class="content-pane w-100 flex-wrap">
<form class="w-100">
<div class="form-group">
<label>text</label>
<textarea class="form-control" id="input_text3" rows="3"
oninput="updateLink()">你好</textarea>
</div>
<div class="form-group">
<label>id</label>
<select class="form-control" id="input_id3" oninput="updateLink()">
{% for speaker in speakers["BERT-VITS2"] %}
<option value="{{ speaker["id"] }}">{{ speaker["id"] }} | {{ speaker["name"] }}
| {{ speaker["lang"] }}</option>
{% endfor %}
{% if bert_vits2_speakers_count <=0 %}
<option value="" disabled selected hidden>未加载模型</option>
{% endif %}
</select>
</div>
</form>
<form class="w-100">
<div class="row">
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="默认为wav">format</label>
<select class="form-control" id="input_format3" oninput="updateLink()">
<option></option>
<option>wav</option>
<option>mp3</option>
<option>ogg</option>
<option>silk</option>
<option>flac</option>
</select>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="自动识别语言auto:可识别的语言根据不同speaker而不同,方言无法自动识别。方言模型需要手动指定语言,比如粤语Cantonese要指定参数lang=gd">lang</label>
<input type="text" class="form-control" id="input_lang3" oninput="updateLink()" value=""
placeholder="auto"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="调节语音长度,相当于调节语速,该数值越大语速越慢。">length</label>
<input type="number" class="form-control" id="input_length3" oninput="updateLink()" value=""
placeholder="1" min="0" step="0.001"/>
</div>
</div>
<div class="row">
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="样本噪声,控制合成的随机性。">noise</label>
<input type="number" class="form-control" id="input_noise3" oninput="updateLink()" value=""
placeholder="0.5" min="0" step="0.001"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="随机时长预测器噪声,控制音素发音长度。">noisew</label>
<input type="number" class="form-control" id="input_noisew3" oninput="updateLink()" value=""
placeholder="0.6" min="0" step="0.001"/>
</div>
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="按标点符号分段,加起来大于max时为一段文本。max<=0表示不分段。">max</label>
<input type="number" class="form-control" id="input_max3" oninput="updateLink()" value=""
placeholder="50" step="1"/>
</div>
</div>
<div class="row">
<div class="col-md-4 form-group">
<label data-toggle="tooltip" data-placement="top"
title="SDP/DP混合比:SDP在合成时的占比,理论上此比率越高,合成的语音语调方差越大。">sdp_radio</label>
<input type="number" class="form-control" id="input_sdp_ratio" oninput="updateLink()"
value=""
placeholder="0.2" step="0.01" min="0" max="1"/>
</div>
</div>
</form>
<div class="flex flex-wrap w-100"
style="justify-content: center; align-items: center; height: 80px; margin-top: 20px; margin-bottom: 20px; border: 1px solid rgba(0,0,0,.125); border-radius: 0.25rem;">
<button type="button" class="btn btn-outline-secondary" onclick="setAudioSource()"
style="margin-right: 10px">
播放器生成
</button>
<audio id="audioPlayer3" controls>
<source src="" type="audio/mp3"/>
Your browser does not support the audio element.
</audio>
</div>
</div>
</div>
<div class="mt-2">
{% if speakers_count == 0 %}
<div style="color: red;">未加载任何模型</div>
{% endif %}
<div>
<label>返回speakers(json):</label>
<a id="speakers_link" href="https://artrajz-vits-simple-api.hf.space/voice/speakers" target="_blank"
style="text-decoration: none; color: black">
https://artrajz-vits-simple-api.hf.space/voice/speakers
</a>
</div>
<div>
<label>API调用:</label>
<a id="vits_link" href="https://artrajz-vits-simple-api.hf.space/voice/vits?text=你好,こんにちは&id=164"
style="text-decoration: none; color: black">
https://artrajz-vits-simple-api.hf.space/voice/vits?text=你好,こんにちは&id=164
</a>
</div>
</div>
</div>
<<div>
<h2>所有模型均为网络搜集,感谢模型原作者的付出!</h2>
<h2>请严格遵循模型原作者使用协议!</h2>
<p>
Nene_Nanami_Rong_Tang:
<a href="https://github.com/CjangCjengh/TTSModels" rel="noreferrer" target="_blank">CjangCjengh/TTSModels</a>
</p>
<p>
louise:
<a href="https://github.com/CjangCjengh/TTSModels" rel="noreferrer" target="_blank">CjangCjengh/TTSModels</a>
</p>
<p>
Cantonese:
<a href="https://github.com/CjangCjengh/TTSModels" rel="noreferrer" target="_blank">CjangCjengh/TTSModels</a>
</p>
<p>
shanghainese:
<a href="https://github.com/CjangCjengh/TTSModels" rel="noreferrer" target="_blank">CjangCjengh/TTSModels</a>
</p>
<p>
w2v2-vits:
<a href="https://github.com/CjangCjengh/TTSModels" rel="noreferrer" target="_blank">CjangCjengh/TTSModels</a>
</p>
<p>
vctk:
<a href="https://github.com/jaywalnut310/vits" rel="noreferrer" target="_blank">jaywalnut310/vits</a>
</p>
<p>
Bishojo Mangekyo:
<a href="https://github.com/Francis-Komizu/VITS" rel="noreferrer" target="_blank">Francis-Komizu/VITS</a>
</p>
<p>
genshin:
<a href="https://huggingface.co/spaces/zomehwh/vits-uma-genshin-honkai" rel="noreferrer" target="_blank">zomehwh/vits-uma-genshin-honkai</a>
</p>
<p>
paimon:
<a href="https://github.com/zixiiu/Digital_Life_Server" rel="noreferrer" target="_blank">zixiiu/Digital_Life_Server</a>
</p>
<p>
vits_chinese:
<a href="https://github.com/PlayVoice/vits_chinese" rel="noreferrer" target="_blank">PlayVoice/vits_chinese</a>
</p>
</div>
</div>
<br/>
</main>
<script src="/static/js/jquery.slim.min.js"></script>
<script src="/static/js/bootstrap.bundle.min.js"></script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
function getProtocol() {
return 'https:' == location.protocol ? "https://" : "http://";
}
function getUrl() {
var url = window.location.host;
return url;
}
var baseUrl = getProtocol() + getUrl();
var model_type = 1;
var vits_status = false;
var w2v2_status = false;
var bert_vits2_status = false;
{% if vits_speakers_count > 0 %}
vits_status = true;
{% endif %}
{% if w2v2_speakers_count > 0 %}
w2v2_status = true;
{% endif %}
{% if bert_vits2_speakers_count > 0 %}
bert_vits2_status = true;
{% endif %}
setBaseUrl();
function setBaseUrl() {
var text = document.getElementById("input_text" + model_type).value;
var id = document.getElementById("input_id" + model_type).value;
var vits_link = document.getElementById("vits_link");
var speakers_link = document.getElementById("speakers_link");
var vits_url = baseUrl + "/voice/vits?text=" + text + "&id=" + id;
var speakers_url = baseUrl + "/voice/speakers";
vits_link.href = vits_url;
vits_link.textContent = vits_url;
speakers_link.href = speakers_url;
speakers_link.textContent = speakers_url;
}
function getLink() {
var text = document.getElementById("input_text" + model_type).value;
var id = document.getElementById("input_id" + model_type).value;
var format = document.getElementById("input_format" + model_type).value;
var lang = document.getElementById("input_lang" + model_type).value;
var length = document.getElementById("input_length" + model_type).value;
var noise = document.getElementById("input_noise" + model_type).value;
var noisew = document.getElementById("input_noisew" + model_type).value;
var max = document.getElementById("input_max" + model_type).value;
if (model_type == 1) {
var url = baseUrl + "/voice/vits?text=" + text + "&id=" + id;
var streaming = document.getElementById('streaming' + model_type);
} else if (model_type == 2) {
var emotion = document.getElementById('emotion').value;
var url = baseUrl + "/voice/w2v2-vits?text=" + text + "&id=" + id + "&emotion=" + emotion;
} else if (model_type == 3) {
var sdp_ratio = document.getElementById("input_sdp_ratio").value;
var url = baseUrl + "/voice/bert-vits2?text=" + text + "&id=" + id;
}
if (format != "") {
url += "&format=" + format;
}
if (lang != "") {
url += "&lang=" + lang;
}
if (length != "") {
url += "&length=" + length;
}
if (noise != "") {
url += "&noise=" + noise;
}
if (noisew != "") {
url += "&noisew=" + noisew;
}
if (max != "") {
url += "&max=" + max;
}
if (model_type == 1 && streaming.checked) {
url += '&streaming=true';
}
if (model_type == 3 && sdp_ratio != "") {
url += "&sdp_ratio=" + sdp_ratio;
}
return url;
}
function updateLink() {
var url = getLink();
var link = document.getElementById("vits_link");
link.href = url;
link.textContent = url;
}
function setAudioSource() {
if (model_type == 1 && !vits_status) {
alert("未加载VITS模型");
return;
}
if (model_type == 2 && !w2v2_status) {
alert("未加载W2V2-VITS模型");
return;
}
if (model_type == 3 && !bert_vits2_status) {
alert("未加载Bert-VITS2模型");
return;
}
var url = getLink();
// Add a timestamp parameter to prevent browser caching
var timestamp = new Date().getTime();
url += '&t=' + timestamp;
var audioPlayer = document.getElementById("audioPlayer" + model_type);
audioPlayer.src = url;
audioPlayer.play();
}
function showContent(index) {
const panes = document.querySelectorAll(".content-pane");
const buttons = document.querySelectorAll(".tab-button");
model_type = index + 1;
for (let i = 0; i < panes.length; i++) {
if (i === index) {
panes[i].classList.add("active");
buttons[i].classList.add("active");
} else {
panes[i].classList.remove("active");
buttons[i].classList.remove("active");
}
}
updateLink();
}
document.querySelectorAll('.slider-group').forEach(function (group) {
group.addEventListener("input", function (event) {
if (event.target.matches('.slider')) {
let value = event.target.value;
group.querySelector('.slider-input').value = value;
group.querySelector('.slider-value').textContent = value;
} else if (event.target.matches('.slider-input')) {
let value = event.target.value;
group.querySelector('.slider').value = value;
group.querySelector('.slider-value').textContent = value;
}
});
});
</script>
</body>
</html>
|