12 lines
444 B
Python
12 lines
444 B
Python
import os
|
|
|
|
from fastai.learner import load_learner
|
|
from pathlib import Path
|
|
|
|
path = Path(os.path.dirname(os.path.realpath(__file__)))
|
|
|
|
# Make sure to export the model first via the notebook.
|
|
# The exported model is not included in the repository.
|
|
model = load_learner(path/'export.pkl')
|
|
prediction, index, probabilities = model.predict(path/'test-images/grizzly.jpg')
|
|
print(f'Prediction: {prediction}, Probability: {probabilities[index]:0.4f}') |