csukuangfj
commited on
Commit
•
edc5db1
1
Parent(s):
52751f8
add script to generate html for tts apks
Browse files- .gitignore +1 -0
- generate-tts.py +73 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
apk.html
|
generate-tts.py
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
import os
|
3 |
+
import re
|
4 |
+
from pathlib import Path
|
5 |
+
from typing import List
|
6 |
+
|
7 |
+
BASE_URL = "https://huggingface.co/csukuangfj/sherpa-onnx-apk/resolve/main/"
|
8 |
+
|
9 |
+
|
10 |
+
def generate_url(files: List[str]) -> List[str]:
|
11 |
+
ans = []
|
12 |
+
base = BASE_URL
|
13 |
+
for f in files:
|
14 |
+
ans.append(base + str(f))
|
15 |
+
return ans
|
16 |
+
|
17 |
+
|
18 |
+
def get_all_files(d: str, suffix: str) -> List[str]:
|
19 |
+
ans = sorted(Path(d).glob(suffix), reverse=False)
|
20 |
+
return list(map(lambda x: BASE_URL + str(x), ans))
|
21 |
+
|
22 |
+
|
23 |
+
def to_file(filename: str, files: List[str]):
|
24 |
+
content = r"""
|
25 |
+
<h1> APKs for text-to-speech </h1>
|
26 |
+
This page lists the <strong>text-to-speech</strong> APKs for <a href="http://github.com/k2-fsa/sherpa-onnx">sherpa-onnx</a>,
|
27 |
+
one of the deployment frameworks of <a href="https://github.com/k2-fsa">the Next-gen Kaldi project</a>.
|
28 |
+
<br/>
|
29 |
+
The name of an APK has the following rule:
|
30 |
+
<ul>
|
31 |
+
<li> sherpa-onnx-{version}-{arch}-{lang}-tts-{model}.apk
|
32 |
+
</ul>
|
33 |
+
where
|
34 |
+
<ul>
|
35 |
+
<li> version: It specifies the current version, e.g., 1.8.7
|
36 |
+
<li> arch: The architecture targeted by this APK, e.g., arm64-v8a, armeabi-v7a, x86_64, x86
|
37 |
+
<li> lang: The language supported by this APK, e.g., en for English, zh for Chinese, fr for French, de for German, es for Spanish
|
38 |
+
<li> model: The name of the model used in the APK, e.g., vits-ljs, vits-piper-de_DE-thorsten-low, vits-piper-de_DE-thorsten-medium
|
39 |
+
</ul>
|
40 |
+
|
41 |
+
<span style="color:red;">Note:</span> Models from
|
42 |
+
<a href="https://github.com/rhasspy/piper">piper</a> have their names prefixed
|
43 |
+
with <strong>vits-piper-</strong>. For instance, for the model
|
44 |
+
<strong>vits-piper-en_US-lessac-medium.apk</strong>, its original name
|
45 |
+
in <a href="https://github.com/rhasspy/piper">piper</a> is
|
46 |
+
<strong>en_US-lessac-medium.apk</strong>, which is available at
|
47 |
+
<a href="https://huggingface.co/rhasspy/piper-voices/blob/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx">
|
48 |
+
https://huggingface.co/rhasspy/piper-voices/blob/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx
|
49 |
+
</a><br/><br/>
|
50 |
+
|
51 |
+
You can find many more models that have not been converted to <strong>sherpa-onnx</strong>
|
52 |
+
at
|
53 |
+
<a href="https://huggingface.co/rhasspy/piper-voices">https://huggingface.co/rhasspy/piper-voices</a>
|
54 |
+
|
55 |
+
|
56 |
+
<br/>
|
57 |
+
<br/>
|
58 |
+
<div/>
|
59 |
+
"""
|
60 |
+
with open(filename, "w") as f:
|
61 |
+
print(content, file=f)
|
62 |
+
for x in files:
|
63 |
+
name = x.rsplit("/", maxsplit=1)[-1]
|
64 |
+
print(f'<a href="{x}" />{name}<br/>', file=f)
|
65 |
+
|
66 |
+
|
67 |
+
def main():
|
68 |
+
apk = get_all_files("tts", suffix="*.apk")
|
69 |
+
to_file("./apk.html", apk)
|
70 |
+
|
71 |
+
|
72 |
+
if __name__ == "__main__":
|
73 |
+
main()
|