pip3 install setuptools
pip3 install git+https://github.com/lobe/lobe-python
from lobe import ImageModel
model = ImageModel.load('path/to/exported/model')
# OPTION 1: Predict from an image file
result = model.predict_from_file('path/to/file.jpg')
# OPTION 2: Predict from an image url
result = model.predict_from_url('http://path/to/file.jpg')
# OPTION 3: Predict from Pillow image
from PIL import Image
img = Image.open('path/to/file.jpg')
result = model.predict(img)
# Print top prediction
print(result.prediction)
# Print all classes
for label, prop in result.labels:
print(f"{label}: {prop*100}%")