def prescript(file):
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image",type=str, default=file,help="path to input image we are going to classify")
ap.add_argument("-m", "--model",type=str,default="smallvggnet.model",help="path to trained Keras model")
ap.add_argument("-l", "--label-bin",type=str,default="smallvggnet_lb.pickle",help="path to label binarizer")
ap.add_argument("-w", "--width", type=int, default=64, help="target spatial dimension width")
ap.add_argument("-e", "--height", type=int, default=64, help="target spatial dimension height")
ap.add_argument("-f", "--flatten", type=int, default=-1, help="whether or not we should flatten the image")
args = vars(ap.parse_args())
image = cv2.imread(file)
output = image.copy()
image = cv2.resize(image, (args["width"], args["height"]))
image = image.astype("float") / 255.0
if args["flatten"] > 0:
image = image.flatten()
image = image.reshape((1, image.shape[0]))
else:
image = image.reshape((1, image.shape[0], image.shape[1], image.shape[2]))
model = load_model(args["model"])
lb = pickle.loads(open(args["label_bin"], "rb").read())
preds = model.predict(image)
i = preds.argmax(axis=1)[0]
label = lb.classes_[i]
text = "{}: {:.2f}%".format(label, preds[0][i] * 100)
print(text[0])
global result
result = text[0]
lb = pickle.loads(open(args["label_bin"], "rb").read())
ModuleNotFoundError: No module named 'sklearn.preprocessing.label'
requirements.txt