csukuangfj commited on
Commit
5d6833f
1 Parent(s): 3576a20

apks for WearOS

Browse files
generate-audio-tagging-wearos.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from dataclasses import dataclass
10
+
11
+
12
+ @dataclass
13
+ class APK:
14
+ major: int
15
+ minor: int
16
+ patch: int
17
+ arch: str
18
+ short_name: str
19
+
20
+ def __init__(self, s):
21
+ s = str(s)[len("audio-tagging-wearos/") :]
22
+ split = s.split("-")
23
+ self.major, self.minor, self.patch = list(map(int, split[2].split(".")))
24
+ self.arch = split[3]
25
+ self.short_name = split[6]
26
+ if "arm" in s:
27
+ self.arch += "-" + split[4]
28
+ self.short_name = split[7]
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
+ if "small" in self.short_name:
37
+ self.short_name = "zzz" + self.short_name
38
+
39
+
40
+ def sort_by_apk(x):
41
+ x = APK(x)
42
+ return (x.major, x.minor, x.patch, x.arch, x.short_name)
43
+
44
+
45
+ def generate_url(files: List[str]) -> List[str]:
46
+ ans = []
47
+ base = BASE_URL
48
+ for f in files:
49
+ ans.append(base + str(f))
50
+ return ans
51
+
52
+
53
+ def get_all_files(d: str, suffix: str) -> List[str]:
54
+ ans = sorted(Path(d).glob(suffix), key=sort_by_apk, reverse=True)
55
+ return list(map(lambda x: BASE_URL + str(x), ans))
56
+
57
+
58
+ def to_file(filename: str, files: List[str]):
59
+ content = r"""
60
+ <h1> WearOS APKs for Audio tagging </h1>
61
+ This page lists the <strong>audio tagging</strong> <em>WearOS</em> APKs for <a href="http://github.com/k2-fsa/sherpa-onnx">sherpa-onnx</a>,
62
+ one of the deployment frameworks of <a href="https://github.com/k2-fsa">the Next-gen Kaldi project</a>.
63
+ <br/>
64
+ The name of an APK has the following rule:
65
+ <ul>
66
+ <li> sherpa-onnx-{version}-{arch}-audio-tagging-{model}.apk
67
+ </ul>
68
+ where
69
+ <ul>
70
+ <li> version: It specifies the current version, e.g., 1.9.21
71
+ <li> arch: The architecture targeted by this APK, e.g., arm64-v8a, armeabi-v7a, x86_64, x86
72
+ <li> model: The name of the model used in the APK
73
+ </ul>
74
+
75
+ <br/><br/>
76
+
77
+ You can download all supported models from
78
+ <a href="https://github.com/k2-fsa/sherpa-onnx/releases/tag/audio-tagging-models">https://github.com/k2-fsa/sherpa-onnx/releases/tag/audio-tagging-models</a>
79
+
80
+ <br/>
81
+ <br/>
82
+
83
+ Please see
84
+ <a href="https://k2-fsa.github.io/sherpa/onnx/audio-tagging/">https://k2-fsa.github.io/sherpa/onnx/audio-tagging/</a>
85
+ for more information.
86
+
87
+ <br/>
88
+ <br/>
89
+
90
+ For APKs running on Android phones, please see
91
+ <a href="https://k2-fsa.github.io/sherpa/onnx/audio-tagging/apk.html">https://k2-fsa.github.io/sherpa/onnx/audio-tagging/apk.html</a>
92
+
93
+ <br/>
94
+ <br/>
95
+ <div/>
96
+ """
97
+ with open(filename, "w") as f:
98
+ print(content, file=f)
99
+ for x in files:
100
+ name = x.rsplit("/", maxsplit=1)[-1]
101
+ print(f'<a href="{x}" />{name}<br/>', file=f)
102
+
103
+
104
+ def main():
105
+ apk = get_all_files("audio-tagging-wearos", suffix="*.apk")
106
+ to_file("./apk-audio-tagging-wearos.html", apk)
107
+
108
+
109
+ if __name__ == "__main__":
110
+ main()
generate-audio-tagging.py CHANGED
@@ -84,6 +84,12 @@ Please see
84
  <a href="https://k2-fsa.github.io/sherpa/onnx/audio-tagging/">https://k2-fsa.github.io/sherpa/onnx/audio-tagging/</a>
85
  for more information.
86
 
 
 
 
 
 
 
87
  <br/>
88
  <br/>
89
  <div/>
 
84
  <a href="https://k2-fsa.github.io/sherpa/onnx/audio-tagging/">https://k2-fsa.github.io/sherpa/onnx/audio-tagging/</a>
85
  for more information.
86
 
87
+ <br/>
88
+ <br/>
89
+
90
+ For APKs running on Android wathces with WearOS, please see
91
+ <a href="https://k2-fsa.github.io/sherpa/onnx/audio-tagging/apk-wearos.html">https://k2-fsa.github.io/sherpa/onnx/audio-tagging/apk-wearos.html</a>
92
+
93
  <br/>
94
  <br/>
95
  <div/>