csukuangfj commited on
Commit
e1f0cdd
·
1 Parent(s): 4a7f923

generate html files

Browse files
Files changed (4) hide show
  1. .gitignore +2 -0
  2. __init__.py +0 -0
  3. build-generate-subtitles.py +223 -0
  4. version.py +3 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ __pycache__
2
+ *.html
__init__.py ADDED
File without changes
build-generate-subtitles.py ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import os
3
+ import re
4
+ from pathlib import Path
5
+ from typing import List
6
+ from version import min_major, min_minor, min_patch
7
+
8
+ BASE_URL = "https://huggingface.co/csukuangfj/sherpa-onnx-bin/resolve/main/"
9
+
10
+ from dataclasses import dataclass
11
+
12
+
13
+ @dataclass
14
+ class APP:
15
+ major: int
16
+ minor: int
17
+ patch: int
18
+ os: str
19
+ arch: str
20
+ short_name: str
21
+
22
+ def __init__(self, s):
23
+ # sherpa-onnx-1.10.21-generate-subtitles-macos-arm64-paraformer_small_2024_03_09-zh_en.app.tar.bz2
24
+
25
+ s = str(s).split("/")[-1]
26
+ split = s.split("-")
27
+ self.major, self.minor, self.patch = list(map(int, split[2].split(".")))
28
+ self.os = split[5]
29
+ self.arch = split[6]
30
+ self.lang = split[8]
31
+ self.short_name = split[7]
32
+
33
+
34
+ def sort_by_app(x):
35
+ x = APP(x)
36
+ return (x.major, x.minor, x.patch, x.os, x.arch, x.short_name, x.lang)
37
+
38
+
39
+ def get_all_files(d_list: List[str], suffix: str) -> List[str]:
40
+ if isinstance(d_list, str):
41
+ d_list = [d_list]
42
+
43
+ ss = []
44
+ for d in d_list:
45
+ for root, _, files in os.walk(d):
46
+ for f in files:
47
+ if f.endswith(suffix):
48
+ major, minor, patch = list(map(int, f.split("-")[2].split(".")))
49
+ if major >= min_major and minor >= min_minor and patch >= min_patch:
50
+ ss.append(os.path.join(root, f))
51
+
52
+ ans = sorted(ss, key=sort_by_app, reverse=True)
53
+
54
+ return list(map(lambda x: BASE_URL + str(x), ans))
55
+
56
+
57
+ def to_file(filename: str, files: List[str]):
58
+ content = r"""
59
+ <h1> APPs for generating subtitles (生成字幕) </h1>
60
+ This page lists the APPs for <strong>generating subtitles</strong> using <a href="http://github.com/k2-fsa/sherpa-onnx">sherpa-onnx</a>,
61
+ one of the deployment frameworks of <a href="https://github.com/k2-fsa">the Next-gen Kaldi project</a>.
62
+ <br/>
63
+ The name of an APP has the following rule:
64
+ <ul>
65
+ <li> sherpa-onnx-{version}-generate-subtitles-{os}-{arch}-{model}-{lang}
66
+ </ul>
67
+ where
68
+ <ul>
69
+ <li> version: It specifies the current version, e.g., 1.10.21
70
+ <li> os: maocs, windows, linux,
71
+ <li> arch: The architecture targeted by this APP, e.g., x64, arm64
72
+ <li> model: The name of the model used in the APP, e.g.,
73
+ <a href="https://arxiv.org/abs/2310.11230">Zipformer</a>,
74
+ <a href="https://github.com/openai/whisper">Whisper</a>,
75
+ <a href="https://github.com/modelscope/FunASR">Paraformer</a>,
76
+ <a href="https://github.com/FunAudioLLM/SenseVoice">SenseVoice</a>
77
+ <li> lang: The lang of the model used in the APP, e.g., en for English, zh for Chinese, ja for Japanese, ko for Korean
78
+ </ul>
79
+
80
+ <br/>
81
+ <br/>
82
+
83
+ You can download all supported models from
84
+ <a href="https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models">https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models</a>
85
+
86
+ <br/>
87
+ <br/>
88
+
89
+ <strong>Note about the license</strong> The code of Next-gen Kaldi is using
90
+ <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache-2.0 license</a>. However,
91
+ we support models from different frameworks. Please check the license of your selected model.
92
+
93
+ <br/>
94
+ <br/>
95
+
96
+ <!--
97
+ see https://www.tablesgenerator.com/html_tables#
98
+ -->
99
+
100
+ <style type="text/css">
101
+ .tg {border-collapse:collapse;border-spacing:0;}
102
+ .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
103
+ overflow:hidden;padding:10px 5px;word-break:normal;}
104
+ .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
105
+ font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
106
+ .tg .tg-0pky{border-color:inherit;text-align:left;vertical-align:top}
107
+ .tg .tg-0lax{text-align:left;vertical-align:top}
108
+ </style>
109
+ <table class="tg">
110
+ <thead>
111
+ <tr>
112
+ <th class="tg-0pky">APP</th>
113
+ <th class="tg-0lax">Comment</th>
114
+ <th class="tg-0pky">ASR Model</th>
115
+ <th class="tg-0pky">VAD Model</th>
116
+ </tr>
117
+ </thead>
118
+ <tbody>
119
+ <tr>
120
+ <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>zipformer_reazonspeech</strong>_2024_08_01-ja</td>
121
+ <td class="tg-0lax">It supports only <strong>Japanese</strong> (日语). Please refer to the <a href="https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-transducer/zipformer-transducer-models.html#sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01-japanese">doc</a> for more details.</td>
122
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01.tar.bz2">sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01.tar.bz2</td>
123
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx">silero_vad.onnx</a></td>
124
+ </tr>
125
+
126
+ <tr>
127
+ <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>zipformer_gigaspeech2</strong>-th</td>
128
+ <td class="tg-0lax">It supports only <strong>Thai</strong> (泰语). Please refer to the <a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01.tar.bz2">doc</a> for more details.</td>
129
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-thai-2024-06-20.tar.bz2
130
+ ">sherpa-onnx-zipformer-thai-2024-06-20.tar.bz2</td>
131
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx">silero_vad.onnx</a></td>
132
+ </tr>
133
+
134
+ <tr>
135
+ <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>whisper_tiny.en</strong>-en</td>
136
+ <td class="tg-0lax">It supports only <strong>English</strong> (英语). Please see the <a href="https://k2-fsa.github.io/sherpa/onnx/pretrained_models/whisper/tiny.en.html">doc</a> for more details. Whereas we are using tiny.en here, you are free to switch to other kinds of models, e.g., <a href="https://k2-fsa.github.io/sherpa/onnx/pretrained_models/whisper/export-onnx.html#available-models">base</a>.</td>
137
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-tiny.en.tar.bz2">sherpa-onnx-whisper-tiny.en</a></td>
138
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx">silero_vad.onnx</a></td>
139
+ </tr>
140
+
141
+ <tr>
142
+ <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>sense_voice</strong>-zh_en_ko_ja_yue</td>
143
+ <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports
144
+ <strong>Chinese, English, Korean, Japense, Cantonese</strong> (中文、英语、韩语、日语、粤语供 5 种语言). Please refer to the
145
+ <a href="https://k2-fsa.github.io/sherpa/onnx/sense-voice/index.html">doc</a> for more details.</span></td>
146
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17.tar.bz2">sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17.tar.bz2</a></td>
147
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx">silero_vad.onnx</a></td>
148
+ </tr>
149
+
150
+ <tr>
151
+ <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>paraformer_2023_09_14-</strong>-zh_en</td>
152
+ <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports
153
+ <strong>Chinese and English</strong> (中英双语). Please refer to the
154
+ <a href="https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-paraformer/paraformer-models.html#csukuangfj-sherpa-onnx-paraformer-zh-2023-09-14-chinese-english">doc</a> for more details.</span></td>
155
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2">sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2</a></td>
156
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx">silero_vad.onnx</a></td>
157
+ </tr>
158
+
159
+ <tr>
160
+ <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>zipformer_wenetspeech</strong>-zh</td>
161
+ <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports only <strong>Chinese</strong> (中文). Please
162
+ refer to the <a href="https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-transducer/zipformer-transducer-models.html#pkufool-icefall-asr-zipformer-wenetspeech-20230615-chinese">doc</a> for more details.</span></td>
163
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/icefall-asr-zipformer-wenetspeech-20230615.tar.bz2">icefall-asr-zipformer-wenetspeech-20230615.tar.bz2</a></td>
164
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx">silero_vad.onnx</a></td>
165
+ </tr>
166
+
167
+ <tr>
168
+ <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>zipformer_gigaspeech</strong>-zh</td>
169
+ <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports only <strong>English</strong> (英语). Please
170
+ refer to the <a href="https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-transducer/zipformer-transducer-models.html#sherpa-onnx-zipformer-gigaspeech-2023-12-12-english">doc</a> for more details.</span></td>
171
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-gigaspeech-2023-12-12.tar.bz2">sherpa-onnx-zipformer-gigaspeech-2023-12-12.tar.bz2</a></td>
172
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx">silero_vad.onnx</a></td>
173
+ </tr>
174
+
175
+ <tr>
176
+ <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>paraformer_small_2024_03_09</strong>-zh_en</td>
177
+ <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports <strong>Chinese and English</strong> (中英双语). Please
178
+ refer to the <a href="https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-paraformer/paraformer-models.html#csukuangfj-sherpa-onnx-paraformer-zh-small-2024-03-09-chinese-english">doc</a> for more details. It uses a small Paraformer model.</span></td>
179
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-small-2024-03-09.tar.bz2">sherpa-onnx-paraformer-zh-small-2024-03-09.tar.bz2</a></td>
180
+ <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx">silero_vad.onnx</a></td>
181
+ </tr>
182
+ </tbody>
183
+ </table>
184
+
185
+ <br/>
186
+ <br/>
187
+
188
+ <div/>
189
+ """
190
+ if "-cn" not in filename:
191
+ content += """
192
+ For Chinese users, please <a href="./download-generated-subtitles-cn.html">visit this address</a>,
193
+ which replaces <a href="huggingface.co">huggingface.co</a> with <a href="hf-mirror.com">hf-mirror.com</a>
194
+ <br/>
195
+ <br/>
196
+ 中国用户, 请访问<a href="./download-generated-subtitles-cn.html">这个地址</a>
197
+ <br/>
198
+ <br/>
199
+ """
200
+
201
+ with open(filename, "w") as f:
202
+ print(content, file=f)
203
+ for x in files:
204
+ name = x.rsplit("/", maxsplit=1)[-1]
205
+ print(f'<a href="{x}" />{name}<br/>', file=f)
206
+
207
+
208
+ def main():
209
+ app = get_all_files("generate-subtitles", suffix=".tar.bz2")
210
+ to_file("./download-generated-subtitles.html", app)
211
+
212
+ # for Chinese users
213
+ app2 = []
214
+ for a in app:
215
+ a = a.replace("huggingface.co", "hf-mirror.com")
216
+ a = a.replace("resolve", "blob")
217
+ app2.append(a)
218
+
219
+ to_file("./download-generated-subtitles-cn.html", app2)
220
+
221
+
222
+ if __name__ == "__main__":
223
+ main()
version.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ min_major = 1
2
+ min_minor = 9
3
+ min_patch = 10