-
Notifications
You must be signed in to change notification settings - Fork 0
/
tea.yaml
33 lines (26 loc) · 896 Bytes
/
tea.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# https://tea.xyz/what-is-this-file
---
version: 1.0.0
codeOwners:
- '0x26cE9841FfC59dBF1054d1A0799F5eAe02664ef0'
- '0xcC9E291C5f3D14Fa5056B55FDBcDAeD2F8324042'
quorum: 1
from lobe import ImageModel
model = ImageModel.load('path/to/exported/model/folder')
# 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://url/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, confidence in result.labels:
print(f"{label}: {confidence*100}%")
# Visualize the heatmap of the prediction on the image
# this shows where the model was looking to make its prediction.
heatmap = model.visualize(img)
heatmap.show()