SI-projekt-smieciarka/snn/snn.py
2022-05-27 05:26:14 +02:00

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)