Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f1e1889

Browse files
committedSep 27, 2023
Allow tensorflow in place of tflite
As a distro we are packaging tensorflow, but not tflite. The latter is a small cut-out of tensorflow, so they share the same entrypoint. This allows us to provide tensorflow in place of tflite, at the cost of a higher runtime closure size, but reduced maintenance load.
1 parent 87ff05c commit f1e1889

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed
 

‎programs/wake/openwakeword-lite/bin/server/openwakeword.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
from typing import List
44

55
import numpy as np
6-
import tflite_runtime.interpreter as tflite
6+
try:
7+
import tflite_runtime.interpreter as tflite
8+
except ModuleNotFoundError:
9+
from tensorflow.lite.python.interpreter import Interpreter as tflite
710

811
from wyoming.wake import Detection
912

‎programs/wake/openwakeword-lite/server/wyoming_openwakeword/openwakeword.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
from typing import List, Optional, TextIO
55

66
import numpy as np
7-
import tflite_runtime.interpreter as tflite
7+
try:
8+
import tflite_runtime.interpreter as tflite
9+
except ModuleNotFoundError:
10+
from tensorflow.lite.python.interpreter import Interpreter as tflite
811

912
from wyoming.wake import Detection
1013

‎programs/wake/precise-lite/bin/precise_shared.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
from typing import Any, Optional, Union
2525

2626
import numpy as np
27-
import tflite_runtime.interpreter as tflite
27+
try:
28+
import tflite_runtime.interpreter as tflite
29+
except ModuleNotFoundError:
30+
from tensorflow.lite.python.interpreter import Interpreter as tflite
2831
from sonopy import mfcc_spec
2932

3033
MAX_WAV_VALUE = 32768

0 commit comments

Comments
 (0)
Please sign in to comment.