-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
28 lines (22 loc) · 837 Bytes
/
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
import sys
from handmodel import InferenceModel
from interface import ComputerInterface
def main(debug=False):
interface = ComputerInterface()
inference_model = InferenceModel(threshold=0.75, gesture_duration_threshold=0.5, repeat_threshold=5)
inference_model.start_inference()
gesture_queue = inference_model.gesture_queue
print('Started inference loop')
try:
while True:
gesture, confidence = gesture_queue.get(block=True)
interface.recieve_gesture(gesture)
if debug:
print('{:.3f}: {}'.format(confidence, gesture))
except KeyboardInterrupt:
print('\rCleaning up...', flush=True, end=' ')
inference_model.stop_inference()
print('Done')
exit(0)
if __name__ == '__main__':
main(debug=('debug' in sys.argv))