mirror of
https://github.com/google/mozc-devices.git
synced 2025-11-08 16:53:28 +03:00
@@ -16,6 +16,12 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
# Surpress warnings. Please unvail these warnings when development.
|
||||||
|
import warnings
|
||||||
|
warnings.filterwarnings("ignore", category=RuntimeWarning)
|
||||||
|
warnings.filterwarnings("ignore", category=FutureWarning)
|
||||||
|
|
||||||
from nazoru.led import LED_BLUE, LED_RED, LED_CHASSIS
|
from nazoru.led import LED_BLUE, LED_RED, LED_CHASSIS
|
||||||
import time
|
import time
|
||||||
LED_RED.blink(1)
|
LED_RED.blink(1)
|
||||||
@@ -67,7 +73,16 @@ def main():
|
|||||||
|
|
||||||
LED_CHASSIS.set_brightness(100)
|
LED_CHASSIS.set_brightness(100)
|
||||||
LED_RED.on()
|
LED_RED.on()
|
||||||
result = predictor.predict_top_n(data, 5)
|
try:
|
||||||
|
result = predictor.predict_top_n(data, 5)
|
||||||
|
except IndexError:
|
||||||
|
# This is possible when pressing keys we don't use for learning.
|
||||||
|
print('Invalid input. (out of range)')
|
||||||
|
continue
|
||||||
|
except ValueError:
|
||||||
|
# This is possible when pressing only one key.
|
||||||
|
print('Invalid input. (one key)')
|
||||||
|
continue
|
||||||
LED_RED.off()
|
LED_RED.off()
|
||||||
LED_CHASSIS.set_brightness(5)
|
LED_CHASSIS.set_brightness(5)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user