99i commited on
Commit
de64bd3
·
verified ·
1 Parent(s): a33e934

Upload 3 files

Browse files
Files changed (3) hide show
  1. index.html +48 -18
  2. script.js +71 -0
  3. styles.css +66 -0
index.html CHANGED
@@ -1,19 +1,49 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>角色信息表</title>
7
+ <link rel="stylesheet" href="styles.css">
8
+ </head>
9
+ <body>
10
+ <h1>角色信息表</h1>
11
+ <div id="filters">
12
+ <label for="gender">性别:</label>
13
+ <select id="gender">
14
+ <option value="">不限</option>
15
+ <option value="Male">男</option>
16
+ <option value="Female">女</option>
17
+ </select>
18
+ <label for="locale">语言:</label>
19
+ <select id="locale">
20
+ <option value="">不限</option>
21
+ <option value="zh-CN">中文</option>
22
+ <!-- 其他语言选项 -->
23
+ </select>
24
+ <!-- 其他筛选选项 -->
25
+ </div>
26
+ <table id="voicesTable">
27
+ <thead>
28
+ <tr>
29
+ <th>显示名称</th>
30
+ <th>性别</th>
31
+ <th>本地名称</th>
32
+ <th>语言</th>
33
+ <th>状态</th>
34
+ <th>采样率</th>
35
+ <th>风格列表</th>
36
+ <th>角色扮演列表</th>
37
+ <th>语音类型</th>
38
+ <th>每分钟单词数</th>
39
+ <th>试听音频</th>
40
+ <!-- 其他表头 -->
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <!-- 角色信息将在这里动态插入 -->
45
+ </tbody>
46
+ </table>
47
+ <script src="script.js"></script>
48
+ </body>
49
  </html>
script.js ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ fetch('https://99i-tts.hf.space/voices?l=zh&d')
3
+ .then(response => response.json())
4
+ .then(data => {
5
+ const voices = data.voices;
6
+ displayVoices(voices);
7
+ setupFilters(voices);
8
+ });
9
+
10
+ function displayVoices(voices) {
11
+ const tableBody = document.getElementById('voicesTable').getElementsByTagName('tbody')[0];
12
+ tableBody.innerHTML = ''; // 清空表格
13
+
14
+ voices.forEach(voice => {
15
+ const row = tableBody.insertRow();
16
+ row.insertCell(0).innerText = voice.ShortName;
17
+ row.insertCell(1).innerText = voice.Gender;
18
+ row.insertCell(2).innerText = voice.LocalName;
19
+ row.insertCell(3).innerText = voice.LocaleName;
20
+ row.insertCell(4).innerText = voice.Status;
21
+ row.insertCell(5).innerText = voice.SampleRateHertz;
22
+ row.insertCell(6).innerText = voice.StyleList ? voice.StyleList.join(', ') : '';
23
+ row.insertCell(7).innerText = voice.RolePlayList ? voice.RolePlayList.join(', ') : '';
24
+ row.insertCell(8).innerText = voice.VoiceType;
25
+ row.insertCell(9).innerText = voice.WordsPerMinute;
26
+ // 插入其他单元格
27
+ // 添加试听音频列
28
+ const audioCell = row.insertCell(10);
29
+ if (voice.StyleList && voice.StyleList.length > 0) {
30
+ voice.StyleList.forEach(style => {
31
+ const styleName = document.createElement('span');
32
+ styleName.innerText = `${style}: `;
33
+ audioCell.appendChild(styleName);
34
+
35
+ const audioUrl = `https://99i-tts.hf.space/tts?v=${voice.ShortName}&t=很高兴见到你&s=${style}`;
36
+ const audio = document.createElement('audio');
37
+ audio.src = audioUrl;
38
+ audio.controls = true;
39
+ audioCell.appendChild(audio);
40
+ });
41
+ } else {
42
+ // 如果没有风格,提供一个默认的试听音频
43
+ const audioUrl = `https://99i-tts.hf.space/tts?v=${voice.ShortName}&t=很高兴见到你`;
44
+ const audio = document.createElement('audio');
45
+ audio.src = audioUrl;
46
+ audio.controls = true;
47
+ audioCell.appendChild(audio);
48
+ }
49
+ });
50
+ }
51
+
52
+ function setupFilters(voices) {
53
+ const genderSelect = document.getElementById('gender');
54
+ const localeSelect = document.getElementById('locale');
55
+
56
+ genderSelect.addEventListener('change', () => filterVoices());
57
+ localeSelect.addEventListener('change', () => filterVoices());
58
+
59
+ function filterVoices() {
60
+ const selectedGender = genderSelect.value;
61
+ const selectedLocale = localeSelect.value;
62
+
63
+ const filteredVoices = voices.filter(voice => {
64
+ return (selectedGender === '' || voice.Gender === selectedGender) &&
65
+ (selectedLocale === '' || voice.Locale === selectedLocale);
66
+ });
67
+
68
+ displayVoices(filteredVoices);
69
+ }
70
+ }
71
+ });
styles.css ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ fetch('https://99i-tts.hf.space/voices?l=zh&amp;d')
3
+ .then(response => response.json())
4
+ .then(data => {
5
+ const voices = data.voices;
6
+ displayVoices(voices);
7
+ setupFilters(voices);
8
+ });
9
+
10
+ function displayVoices(voices) {
11
+ const tableBody = document.getElementById('voicesTable').getElementsByTagName('tbody')[0];
12
+ tableBody.innerHTML = ''; // 清空表格
13
+
14
+ voices.forEach(voice => {
15
+ const row = tableBody.insertRow();
16
+ row.insertCell(0).innerText = voice.DisplayName;
17
+ row.insertCell(1).innerText = voice.Gender;
18
+ row.insertCell(2).innerText = voice.LocalName;
19
+ row.insertCell(3).innerText = voice.LocaleName;
20
+ row.insertCell(4).innerText = voice.Status;
21
+ // 插入其他单元格
22
+ });
23
+ }
24
+
25
+ function setupFilters(voices) {
26
+ const genderSelect = document.getElementById('gender');
27
+ const localeSelect = document.getElementById('locale');
28
+
29
+ genderSelect.addEventListener('change', () => filterVoices());
30
+ localeSelect.addEventListener('change', () => filterVoices());
31
+
32
+ function filterVoices() {
33
+ const selectedGender = genderSelect.value;
34
+ const selectedLocale = localeSelect.value;
35
+
36
+ const filteredVoices = voices.filter(voice => {
37
+ return (selectedGender === '' || voice.Gender === selectedGender) &&
38
+ (selectedLocale === '' || voice.Locale === selectedLocale);
39
+ });
40
+
41
+ displayVoices(filteredVoices);
42
+ }
43
+ }
44
+ });
45
+ body {
46
+ font-family: Arial, sans-serif;
47
+ }
48
+
49
+ #filters {
50
+ margin-bottom: 20px;
51
+ }
52
+
53
+ table {
54
+ width: 100%;
55
+ border-collapse: collapse;
56
+ }
57
+
58
+ th, td {
59
+ border: 1px solid #ddd;
60
+ padding: 8px;
61
+ text-align: left;
62
+ }
63
+
64
+ th {
65
+ background-color: #f2f2f2;
66
+ }