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(path): prediction = learn.predict(path) predictionName = learn.predict(path)[0] # print(prediction, '\n\n','prediction:', predictionName, 'path:', path) return prediction