-
Notifications
You must be signed in to change notification settings - Fork 1
/
sample_precise_indefinite.py
executable file
·44 lines (37 loc) · 1.75 KB
/
sample_precise_indefinite.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
#!/usr/bin/env python3
# Copyright 2019 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# from argparse import ArgumentParser
# from precise.util import activate_notify
from precise_runner import PreciseRunner, PreciseEngine
from threading import Event
def main():
# parser = ArgumentParser('Implementation demo of precise-engine')
# parser.add_argument('engine', help='Location of binary engine file')
# parser.add_argument('model')
# args = parser.parse_args()
def on_prediction(prob):
print('!' if prob > 0.5 else '.')
def on_activation():
print("activation occured")
# activate_notify()
# engine = PreciseEngine(args.engine, args.model)
# engine = PreciseEngine('/home/rbccps2080ti/.virtualenvs/precise/bin/precise-engine', '/home/rbccps2080ti/projects/speech/wake-word-benchmark/audio/computer/hey-computer.net')
engine = PreciseEngine('/home/rbccps2080ti/.virtualenvs/precise/bin/precise-engine', '/home/rbccps2080ti/projects/speech/wake-word-benchmark/audio/computer/hey-computer.net')
PreciseRunner(engine, on_prediction=on_prediction, on_activation=on_activation,
trigger_level=0).start()
Event().wait() # Wait forever
print("hello")
if __name__ == '__main__':
main()