apps/predict.py
def preprocess(image_path):
    '''preprocess the image before feeding it to the model'''
    #  Process a PIL image for use in a PyTorch model
    img = Image.open(image_path)

    # Creating the preprocessor transform
    preprocessing = transforms.Compose([
        transforms.Resize(256),
        transforms.CenterCrop(224),
        transforms.ToTensor(),
        transforms.Normalize(
            mean=[0.485, 0.456, 0.406],
            std=[0.229, 0.224, 0.225]
        )
    ])

    return preprocessing(img)
preprocess the image before feeding it to the model
preprocess the image before feeding it to the model
preprocess the image before feeding it to the model
def preprocess(image_path):
    img = Image.open(image_path)
    preprocessing = transforms.Compose([
        transforms.Resize(256),
        transforms.CenterCrop(224),
        transforms.ToTensor(),
        transforms.Normalize(
            mean=[0.485, 0.456, 0.406],
            std=[0.229, 0.224, 0.225]
        )
    ])
    return preprocessing(img)
def preprocess ( image_path ) : img = Image . open ( image_path ) preprocessing = transforms . Compose ( [ transforms . Resize ( 256 ) , transforms . CenterCrop ( 224 ) , transforms . ToTensor ( ) , transforms . Normalize ( mean = [ 0.485 , 0.456 , 0.406 ] , std = [ 0.229 , 0.224 , 0.225 ] ) ] ) return preprocessing ( img )
preprocess the image before feeding it to the model
preprocess the image before feeding it to the model
'''preprocess the image before feeding it to the model''' #  Process a PIL image for use in a PyTorch model # Creating the preprocessor transform
image_path