csukuangfj
commited on
Commit
·
0175761
1
Parent(s):
b233784
sort apks
Browse files- generate-tts.py +36 -1
generate-tts.py
CHANGED
@@ -6,6 +6,36 @@ 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 = []
|
@@ -16,7 +46,7 @@ def generate_url(files: List[str]) -> List[str]:
|
|
16 |
|
17 |
|
18 |
def get_all_files(d: str, suffix: str) -> List[str]:
|
19 |
-
ans = sorted(Path(d).glob(suffix), reverse=True)
|
20 |
return list(map(lambda x: BASE_URL + str(x), ans))
|
21 |
|
22 |
|
@@ -48,6 +78,11 @@ in <a href="https://github.com/rhasspy/piper">piper</a> is
|
|
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>
|
|
|
6 |
|
7 |
BASE_URL = "https://huggingface.co/csukuangfj/sherpa-onnx-apk/resolve/main/"
|
8 |
|
9 |
+
from dataclasses import dataclass
|
10 |
+
@dataclass
|
11 |
+
class APK:
|
12 |
+
major: int
|
13 |
+
minor: int
|
14 |
+
patch: int
|
15 |
+
arch: str
|
16 |
+
lang: str
|
17 |
+
src: str # piper, coqui
|
18 |
+
def __init__(self, s):
|
19 |
+
s = str(s)
|
20 |
+
split = s.split('-')
|
21 |
+
self.major, self.minor, self.patch = list(map(int, split[2].split('.')))
|
22 |
+
self.arch = split[3]
|
23 |
+
self.lang = split[4]
|
24 |
+
self.src = split[7]
|
25 |
+
if 'arm' in s:
|
26 |
+
self.arch += '-' + split[4]
|
27 |
+
self.lang = split[5]
|
28 |
+
self.src = split[8]
|
29 |
+
|
30 |
+
if 'armeabi' in self.arch:
|
31 |
+
self.arch = 'y' + self.arch
|
32 |
+
|
33 |
+
if 'arm64' in self.arch:
|
34 |
+
self.arch = 'z' + self.arch
|
35 |
+
|
36 |
+
def sort_by_apk(x):
|
37 |
+
x = APK(x)
|
38 |
+
return (x.major, x.minor, x.patch, x.arch, -ord(x.src[0]),-ord(x.lang[0]))
|
39 |
|
40 |
def generate_url(files: List[str]) -> List[str]:
|
41 |
ans = []
|
|
|
46 |
|
47 |
|
48 |
def get_all_files(d: str, suffix: str) -> List[str]:
|
49 |
+
ans = sorted(Path(d).glob(suffix), key=sort_by_apk, reverse=True)
|
50 |
return list(map(lambda x: BASE_URL + str(x), ans))
|
51 |
|
52 |
|
|
|
78 |
https://huggingface.co/rhasspy/piper-voices/blob/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx
|
79 |
</a><br/><br/>
|
80 |
|
81 |
+
<span style="color:red;">Note:</span> Models from
|
82 |
+
<a href="https://github.com/coqui-ai/TTS">coqui-ai/TTS</a> have their names prefixed
|
83 |
+
with <strong>coqui-</strong>.
|
84 |
+
<br/><br/>
|
85 |
+
|
86 |
You can find many more models that have not been converted to <strong>sherpa-onnx</strong>
|
87 |
at
|
88 |
<a href="https://huggingface.co/rhasspy/piper-voices">https://huggingface.co/rhasspy/piper-voices</a>
|