forked from sushi057/transcribe-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configs.py
94 lines (84 loc) · 1.3 KB
/
configs.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import tensorflow as tf
# Necessary global configs
LOAD_MFCC_FILES = True
FRAME_SIZE = 160
SR = 16000
FRAME_RATE = int(SR / FRAME_SIZE)
N_MFCC = 13
HOP_LENGTH = 40
assert FRAME_SIZE % HOP_LENGTH == 0
INPUT_DIM = int(N_MFCC * (FRAME_SIZE / HOP_LENGTH))
UNQ_CHARS = [
" ",
"ँ",
"ं",
"ः",
"अ",
"आ",
"इ",
"ई",
"उ",
"ऊ",
"ऋ",
"ए",
"ऐ",
"ओ",
"औ",
"क",
"ख",
"ग",
"घ",
"ङ",
"च",
"छ",
"ज",
"झ",
"ञ",
"ट",
"ठ",
"ड",
"ढ",
"ण",
"त",
"थ",
"द",
"ध",
"न",
"प",
"फ",
"ब",
"भ",
"म",
"य",
"र",
"ल",
"व",
"श",
"ष",
"स",
"ह",
"ा",
"ि",
"ी",
"ु",
"ू",
"ृ",
"े",
"ै",
"ो",
"ौ",
"्",
"ॠ",
"\u200c",
"\u200d",
"।",
]
UNQ_CHARS = (
["0", "u"] + sorted(UNQ_CHARS) + ["-"]
) # "0" -> padding char,"u" -> unknown chars "-" -> blank char
NUM_UNQ_CHARS = len(UNQ_CHARS) # +1 is for '-' blank at last
MODEL_NAME = "ASR_model"
# Checks for the availability of the GPU
device_name = tf.test.gpu_device_name()
if device_name != "/device:GPU:0":
device_name = "/device:CPU:0"