18 lines
499 B
Python
18 lines
499 B
Python
from fastai.vision.all import *
|
|
import pathlib
|
|
|
|
temp = pathlib.PosixPath
|
|
pathlib.PosixPath = pathlib.WindowsPath
|
|
|
|
DATASET_PATH = pathlib.Path('../dataset')
|
|
|
|
learn = load_learner(DATASET_PATH/'export.pkl')
|
|
path = pathlib.Path(DATASET_PATH / 'others/trash1.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) |