18 lines
480 B
Python
18 lines
480 B
Python
from fastai.vision.all import *
|
|
import pathlib
|
|
|
|
temp = pathlib.PosixPath
|
|
pathlib.PosixPath = pathlib.WindowsPath
|
|
|
|
DATASET_PATH = Path('../dataset')
|
|
|
|
learn = load_learner(DATASET_PATH/'export.pkl')
|
|
path = Path(DATASET_PATH/'glass/glass1.jpg')
|
|
|
|
def getPredict(learner, path):
|
|
prediction = learner.predict(path)
|
|
predictionName = learner.predict(path)[0]
|
|
print(prediction, '\n\n','prediction:', predictionName, 'path:', path)
|
|
return prediction
|
|
|
|
getPredict(learn, path) |