-
Notifications
You must be signed in to change notification settings - Fork 0
/
genhtml.py
73 lines (61 loc) · 1.97 KB
/
genhtml.py
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
#!/usr/bin/env python3
from jinja2 import FileSystemLoader, Environment
import os
import glob
def gen_oneshot_rows():
ret = []
melgan = sorted(glob.glob('data/melgan/*.wav'))
pps = 'data/proposed'
ada = 'data/adain'
vq = 'data/vqvc'
au = 'data/autovc'
for src in melgan:
src_basename = os.path.basename(src).split('.')[0]
for tgt in melgan:
if src == tgt:
continue
tgt_basename = os.path.basename(tgt).split('.')[0]
row = (
src_basename,
tgt_basename,
src,
tgt,
os.path.join(pps, f'{src_basename}_to_{tgt_basename}.wav'),
os.path.join(ada, f'{src_basename}_to_{tgt_basename}.wav'),
os.path.join(vq, f'{src_basename}_to_{tgt_basename}.wav'),
os.path.join(au, f'{src_basename}_to_{tgt_basename}.wav'),
)
ret.append(row)
return ret
def gen_forfun_rows():
ret = []
srcs = sorted(glob.glob('data/forfun/source/*.wav'))
tgts = sorted(glob.glob('data/forfun/target/*.wav'))
pps = 'data/forfun/converted'
for src in srcs:
src_basename = os.path.basename(src).split('.')[0]
for tgt in tgts:
tgt_basename = os.path.basename(tgt).split('.')[0]
row = (
src_basename,
tgt_basename,
src,
tgt,
os.path.join(pps, f'{src_basename}_to_{tgt_basename}.wav'),
)
ret.append(row)
return ret
def main():
"""Main function."""
loader = FileSystemLoader(searchpath="./templates")
env = Environment(loader=loader)
template = env.get_template("base.html.jinja2")
oneshot_rows = gen_oneshot_rows()
forfun_rows = gen_forfun_rows()
html = template.render(
oneshot_rows=oneshot_rows,
forfun_rows=forfun_rows
)
print(html)
if __name__ == "__main__":
main()