SI-projekt-smieciarka/src/snn.py
2022-06-07 21:21:42 +02:00

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