-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·48 lines (39 loc) · 1.45 KB
/
main.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
import logging
import sys
from base_util import LOG_FORMAT
from config import audio_sample_url
import simple_asr
# initialises the root logger
logging.basicConfig(
level=logging.INFO,
stream=sys.stdout, # configure a stream handler only for now (single handler)
format=LOG_FORMAT,
)
logger = logging.getLogger()
# Start the worker
if __name__ == "__main__":
from argparse import ArgumentParser
from base_util import LOG_FORMAT
# first read the CLI arguments
parser = ArgumentParser(description="dane-video-segmentation-worker")
parser.add_argument(
"--input", action="store", dest="input_uri", default=audio_sample_url
)
parser.add_argument("--output", action="store", dest="output_uri", default=None)
parser.add_argument("--log", action="store", dest="loglevel", default="INFO")
args = parser.parse_args()
# initialises the root logger
logging.basicConfig(
stream=sys.stdout, # configure a stream handler only for now (single handler)
format=LOG_FORMAT,
)
# setting the loglevel
log_level = args.loglevel.upper()
logger.setLevel(log_level)
logger.info(f"Logger initialized (log level: {log_level})")
logger.info(f"Got the following CMD line arguments: {args}")
logger.info("very good, running Kaldi_NL")
if args.input_uri:
simple_asr.run(args.input_uri, args.output_uri)
else:
logger.error("Please supply the --input and --output params")