apps/predict.py
def main():
    '''Run the classification with all the options provided and return the predictions'''

    print(
        "*************************************************\nCLASSIFY YOUR FLOWER USING A DEEP NEURAL NETWORK!\n*************************************************\n"
    )

    print('[LOG] Validating arguments...')
    args = parse_args()

    if args.gpu and torch.cuda.is_available():
        device = torch.device("cuda")
        print('[LOG] GPU enabled')
    elif not args.gpu:
        device = torch.device("cpu")
    else:
        raise Exception("[ERROR]--gpu option:  GPU not found")

    print('[LOG] All arguments valid!\n[LOG] Querying the classifier...')
    predictions = predict(
        args.image_path,
        args.checkpoint,
        args.top_k,
        device
    )

    print('[SUCCESS] Query complete!\n[LOG] Image results: ')
    print_pred(predictions, args.category_names)
    return predictions
Run the classification with all the options provided and return the predictions
Run the classification with all the options provided and return the predictions
Run the classification with all the options provided and return the predictions
def main():
    print(
        "*************************************************\nCLASSIFY YOUR FLOWER USING A DEEP NEURAL NETWORK!\n*************************************************\n"
    )
    print('[LOG] Validating arguments...')
    args = parse_args()
    if args.gpu and torch.cuda.is_available():
        device = torch.device("cuda")
        print('[LOG] GPU enabled')
    elif not args.gpu:
        device = torch.device("cpu")
    else:
        raise Exception("[ERROR]--gpu option:  GPU not found")
    print('[LOG] All arguments valid!\n[LOG] Querying the classifier...')
    predictions = predict(
        args.image_path,
        args.checkpoint,
        args.top_k,
        device
    )
    print('[SUCCESS] Query complete!\n[LOG] Image results: ')
    print_pred(predictions, args.category_names)
    return predictions
def main ( ) : print ( "*************************************************\nCLASSIFY YOUR FLOWER USING A DEEP NEURAL NETWORK!\n*************************************************\n" ) print ( '[LOG] Validating arguments...' ) args = parse_args ( ) if args . gpu and torch . cuda . is_available ( ) : device = torch . device ( "cuda" ) print ( '[LOG] GPU enabled' ) elif not args . gpu : device = torch . device ( "cpu" ) else : raise Exception ( "[ERROR]--gpu option:  GPU not found" ) print ( '[LOG] All arguments valid!\n[LOG] Querying the classifier...' ) predictions = predict ( args . image_path , args . checkpoint , args . top_k , device ) print ( '[SUCCESS] Query complete!\n[LOG] Image results: ' ) print_pred ( predictions , args . category_names ) return predictions
Run the classification with all the options provided and return the predictions
Run the classification with all the options provided and return the predictions
'''Run the classification with all the options provided and return the predictions'''