Rename detection_callback to callback
Change-Id: I79de3cb7621139d8a5d69b203779789ec1cbf5cc
diff --git a/voice.py b/voice.py
index da966b6..11c3df4 100644
--- a/voice.py
+++ b/voice.py
@@ -174,7 +174,7 @@
experimental_delegates=[tflite.load_delegate('libedgetpu.so.1',
{'device': device[0]} if device else {})])
-def classify_audio(model_file, labels_file, dectection_callback,
+def classify_audio(model_file, labels_file, callback,
audio_device_index=0, sample_rate_hz=16000,
negative_threshold=0.6, num_frames_hop=33):
"""Acquire audio, preprocess, and classify."""
@@ -215,5 +215,5 @@
continue
if detection != prev_detection:
- keep_listening = dectection_callback(labels[detection], result[detection])
+ keep_listening = callback(labels[detection], result[detection])
prev_detection = detection
diff --git a/voice_example.py b/voice_example.py
index e80d85a..51ced38 100644
--- a/voice_example.py
+++ b/voice_example.py
@@ -14,7 +14,7 @@
import voice
-def detection_callback(label, score):
+def callback(label, score):
print('Detected: "%s", score=%s' % (label, score))
if label.startswith('exit'):
return False # stop listening
@@ -23,7 +23,7 @@
def run_voice_example():
voice.classify_audio(model_file='voice_commands_v0.7_edgetpu.tflite',
labels_file='labels_gc2.raw.txt',
- dectection_callback=detection_callback)
+ callback=callback)
if __name__ == '__main__':
run_voice_example()