-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_server_app.py
More file actions
84 lines (64 loc) · 1.79 KB
/
run_server_app.py
File metadata and controls
84 lines (64 loc) · 1.79 KB
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
import logging
import argparse
from model.model import Model
from model.persistence import Persistence
from server_app.src.process import Process
def parse_args() -> argparse.Namespace:
"""
Parse command line arguments.
:return: Parsed arguments.
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"-u",
"--download-update",
action="store_true",
default=False,
help="Download new images.",
)
parser.add_argument(
"-i",
"--download-init",
action="store_true",
default=False,
help="Initialize image database: Download all the images on the given time interval.",
)
parser.add_argument(
"-cl",
"--classify",
action="store_true",
default=False,
help="Execute classification (does not download images).",
)
parser.add_argument(
"-un",
"--classify-unet",
action="store_true",
default=False,
help="Execute classification with UNET or UNETPP (does not download images).",
)
parsed_args = parser.parse_args()
return parsed_args
def setup_logging() -> None:
"""
Configures logging style.
"""
logging.basicConfig(
format="%(asctime)s %(levelname)-8s %(message)s",
level=logging.INFO,
datefmt="%Y-%m-%d %H:%M:%S",
)
if __name__ == "__main__":
args = parse_args()
setup_logging()
print("AUTOMATIC WASTE DETECTION")
CONFIG_FILE_NAME_DESKTOP_APP = "server_app/resources/config.sample.json"
model = Model(Persistence(config_file_path=CONFIG_FILE_NAME_DESKTOP_APP))
process = Process(
model,
args.download_init,
args.download_update,
args.classify,
args.classify_unet,
)
process.mainloop()