-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.py
52 lines (40 loc) · 1006 Bytes
/
config.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
import xml.etree.ElementTree as ET
attribs = []
tree = ET.parse('config.xml')
root = tree.getroot()
for ele in root:
attribs.append(ele.attrib)
def reload():
tree = ET.parse('config.xml')
root = tree.getroot()
for ele in root:
attribs.append(ele.attrib)
reload()
# MODEL_NAME = "trained_models/new_12_model"
# VIDEO_SOURCE = "p1.mp4"
# CNN_MODEL = "trained_models/safe_unsafe.model"
MODEL_TAG = "./modelname"
VIDEO_TAG = "./videosource"
CNN_TAG = "./cnnmodel"
def get_model():
print(root.find(MODEL_TAG).text)
def get_video_source():
print(root.find(VIDEO_TAG).text)
def get_cnn():
print(root.find(CNN_TAG).text)
def set_video_source(filename):
root.find(VIDEO_TAG).text = filename
tree.write("config.xml")
reload()
def set_model(filename):
root.find(MODEL_TAG).text = filename
tree.write("config.xml")
reload()
def set_cnn(filename):
root.find(CNN_TAG).text = filename
tree.write("config.xml")
reload()
if __name__ == '__main__':
get_model()
get_video_source()
get_cnn()