File size: 13,899 Bytes
e1f0cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7c30d69
 
 
 
 
 
 
 
 
e1f0cdd
 
 
 
 
 
 
 
 
 
 
 
8f4647c
e1f0cdd
 
 
 
 
 
 
 
 
 
 
7c30d69
 
 
 
e1f0cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8f4647c
 
 
 
 
 
 
e1f0cdd
 
 
 
 
 
 
 
 
780dc9e
 
 
 
 
 
 
e1f0cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
import os
import re
from pathlib import Path
from typing import List
from version import min_major, min_minor, min_patch

BASE_URL = "https://huggingface.co/csukuangfj/sherpa-onnx-bin/resolve/main/"

from dataclasses import dataclass


@dataclass
class APP:
    major: int
    minor: int
    patch: int
    os: str
    arch: str
    short_name: str

    def __init__(self, s):
        # sherpa-onnx-1.10.21-generate-subtitles-macos-arm64-paraformer_small_2024_03_09-zh_en.app.tar.bz2

        s = str(s).split("/")[-1]
        split = s.split("-")
        self.major, self.minor, self.patch = list(map(int, split[2].split(".")))
        self.os = split[5]
        self.arch = split[6]
        self.lang = split[8]
        self.short_name = split[7]


def sort_by_app(x):
    x = APP(x)
    return (x.major, x.minor, x.patch, x.os, x.arch, x.short_name, x.lang)


def get_all_files(d_list: List[str], suffix: str) -> List[str]:
    if isinstance(d_list, str):
        d_list = [d_list]

    ss = []
    for d in d_list:
        for root, _, files in os.walk(d):
            for f in files:
                if f.endswith(suffix):
                    major, minor, patch = list(map(int, f.split("-")[2].split(".")))
                    if major >= min_major and minor >= min_minor and patch >= min_patch:
                        ss.append(os.path.join(root, f))

    ans = sorted(ss, key=sort_by_app, reverse=True)

    return list(map(lambda x: BASE_URL + str(x), ans))


def to_file(filename: str, files: List[str]):
    content = r"""
<h1> APPs for generating subtitles (生成字幕) </h1>
This page lists the APPs for <strong>generating subtitles</strong> using <a href="http://github.com/k2-fsa/sherpa-onnx">sherpa-onnx</a>,
one of the deployment frameworks of <a href="https://github.com/k2-fsa">the Next-gen Kaldi project</a>.
<br/>
<br/>
<Strong>Note</Strong>
<ul>
  <li>It runs on <strong>CPU</strong> locally <strong>without accessing the network</strong>
  <li>No need to install anything
  <li>All you need is to download, unzip, and double click to run it
  <li>本地 CPU 运行。下载、解压、双击,即可运行。免安装。
</ul>
<br/>
The name of an APP has the following rule:
<ul>
 <li> sherpa-onnx-{version}-generate-subtitles-{os}-{arch}-{model}-{lang}
</ul>
where
<ul>
 <li> version: It specifies the current version, e.g., 1.10.21
 <li> os: maocs, windows, linux,
 <li> arch: The architecture targeted by this APP, e.g., x64, arm64
 <li> model: The name of the model used in the APP, e.g.,
      <a href="https://arxiv.org/abs/2310.11230">Zipformer</a>,
      <a href="https://github.com/openai/whisper">Whisper</a>,
      <a href="https://github.com/usefulsensors/moonshine">Moonshine</a>,
      <a href="https://github.com/modelscope/FunASR">Paraformer</a>,
      <a href="https://github.com/FunAudioLLM/SenseVoice">SenseVoice</a>
 <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
</ul>

<br/>
<br/>

You can download all supported models from
<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>

<br/>
<br/>
If you are curious about how the APPs are built and want to find the source code, please
visit <a href="https://k2-fsa.github.io/sherpa/onnx/lazarus/generate-subtitles.html">https://k2-fsa.github.io/sherpa/onnx/lazarus/generate-subtitles.html</a>
<br/>
<br/>

<strong>Note about the license</strong> The code of Next-gen Kaldi is using
<a href="https://www.apache.org/licenses/LICENSE-2.0">Apache-2.0 license</a>. However,
we support models from different frameworks. Please check the license of your selected model.

<br/>
<br/>

<!--
see https://www.tablesgenerator.com/html_tables#
-->

<style type="text/css">
.tg  {border-collapse:collapse;border-spacing:0;}
.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
  overflow:hidden;padding:10px 5px;word-break:normal;}
.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
.tg .tg-0pky{border-color:inherit;text-align:left;vertical-align:top}
.tg .tg-0lax{text-align:left;vertical-align:top}
</style>
<table class="tg">
<thead>
  <tr>
    <th class="tg-0pky">APP</th>
    <th class="tg-0lax">Comment</th>
    <th class="tg-0pky">ASR Model</th>
    <th class="tg-0pky">VAD Model</th>
  </tr>
</thead>
<tbody>
  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>zipformer_reazonspeech</strong>_2024_08_01-ja</td>
    <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>
    <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>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>zipformer_gigaspeech2</strong>-th</td>
    <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>
    <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
">sherpa-onnx-zipformer-thai-2024-06-20.tar.bz2</td>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>whisper_tiny.en</strong>-en</td>
    <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>
    <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>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>moonshine_tiny</strong>-en</td>
    <td class="tg-0lax">It supports only <strong>English</strong> (英语). Please see the <a href="https://k2-fsa.github.io/sherpa/onnx/moonshine/models.html">doc</a> for more details.</td>
    <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-tiny-en-int8.tar.bz2">sherpa-onnx-moonshine-tiny-en-int8</a></td>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>sense_voice</strong>-zh_en_ko_ja_yue</td>
    <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports
      <strong>Chinese, English, Korean, Japense, Cantonese</strong> (中文、英语、韩语、日语、粤语供 5 种语言). Please refer to the
      <a href="https://k2-fsa.github.io/sherpa/onnx/sense-voice/index.html">doc</a> for more details.</span></td>
    <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>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>telespeech_ctc</strong>-zh</td>
    <td class="tg-0lax">It supports only Chinese (支持非常多种<strong>中文方言</strong>). It is converted from <a href="https://github.com/Tele-AI/TeleSpeech-ASR">https://github.com/Tele-AI/TeleSpeech-ASR</a>. Please refer to the <a href="https://k2-fsa.github.io/sherpa/onnx/pretrained_models/telespeech/index.html">doc</a> for more details.</td>
    <td class="tg-0pky"><a href="https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-telespeech-ctc-int8-zh-2024-06-04.tar.bz2">sherpa-onnx-telespeech-ctc-int8-zh-2024-06-04.tar.bz2</a></td>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>paraformer_2023_09_14-</strong>-zh_en</td>
    <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports
      <strong>Chinese and English</strong> (中英双语). Please refer to the
      <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>
    <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>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>zipformer_wenetspeech</strong>-zh</td>
    <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports only <strong>Chinese</strong> (中文). Please
      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>
    <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>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>zipformer_gigaspeech</strong>-zh</td>
    <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports only <strong>English</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-gigaspeech-2023-12-12-english">doc</a> for more details.</span></td>
    <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>
    <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>
  </tr>

  <tr>
    <td class="tg-0pky">sherpa-onnx-x.y.z-generate-subtitles-windows-x64-<strong>paraformer_small_2024_03_09</strong>-zh_en</td>
    <td class="tg-0lax"><span style="font-weight:400;font-style:normal">It supports <strong>Chinese and English</strong> (中英双语). Please
      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>
    <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>
    <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>
  </tr>
</tbody>
</table>

<br/>
<br/>

<div/>
    """
    if "-cn" not in filename:
        content += """
        For Chinese users, please <a href="./download-generated-subtitles-cn.html">visit this address</a>,
        which replaces <a href="huggingface.co">huggingface.co</a> with <a href="hf-mirror.com">hf-mirror.com</a>
        <br/>
        <br/>
        中国用户, 请访问<a href="./download-generated-subtitles-cn.html">这个地址</a>
        <br/>
        <br/>
        """

    with open(filename, "w") as f:
        print(content, file=f)
        for x in files:
            name = x.rsplit("/", maxsplit=1)[-1]
            print(f'<a href="{x}" />{name}<br/>', file=f)


def main():
    app = get_all_files("generate-subtitles", suffix=".tar.bz2")
    to_file("./download-generated-subtitles.html", app)

    # for Chinese users
    app2 = []
    for a in app:
        a = a.replace("huggingface.co", "hf-mirror.com")
        a = a.replace("resolve", "blob")
        app2.append(a)

    to_file("./download-generated-subtitles-cn.html", app2)


if __name__ == "__main__":
    main()