Skip to content

Commit 37f6f81

Browse files
committed
Remove numpy requirement from setup.py since TensorFlow and TFLite_runtime require different versions. If both are installed, use the tflite interpreter built into tensorflow instead of the tflite_runtime one.
1 parent d821596 commit 37f6f81

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
mac_version = None
2121

2222
requirements = [
23-
"numpy~=1.19.5",
2423
"pillow~=8.3.1",
2524
"requests"
2625
]

src/lobe/backends/backend_tflite.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
from ..signature_constants import TENSOR_NAME
44
from ..utils import decode_dict_bytes_as_str
55

6+
# first try to import the tflite interpreter from TensorFlow base library (if we have both installed) to avoid a collision
67
try:
7-
import tflite_runtime.interpreter as tflite
8-
8+
import tensorflow.lite as tflite
99
except ImportError:
10-
# Needs better error text
11-
raise ImportError(
12-
"ERROR: This is a TensorFlow Lite model and requires TensorFlow Lite interpreter to be installed on this device. Please install lobe-python with lobe[tflite] or lobe[all] options. If that doesn't work, please go to https://www.tensorflow.org/lite/guide/python and download the appropriate version for you device."
13-
)
10+
try:
11+
import tflite_runtime.interpreter as tflite
12+
13+
except ImportError:
14+
raise ImportError(
15+
"ERROR: This is a TensorFlow Lite model and requires TensorFlow Lite interpreter to be installed on this device. Please install lobe-python with lobe[tflite] or lobe[all] options. If that doesn't work, please go to https://www.tensorflow.org/lite/guide/python and download the appropriate version for you device."
16+
)
1417

1518

1619
class TFLiteModel(object):

0 commit comments

Comments
 (0)