def predict(self, image_source: str, predictions_file: Optional[str]=None, img_format: str='jpg') -> List:
    if os.path.isfile(image_source):
        (image_dir, samples) = image_file_to_json(image_source)
    else:
        image_dir = image_source
        samples = image_dir_to_json(image_source, img_type='jpg')
    n_classes = 10
    batch_size = 64
    samples = []
    sample = {'imgage_id': 'img_1'}
    samples.append(sample)
    data_generator = TestDataGenerator(samples, image_dir, batch_size, n_classes, self.nima.preprocessing_function(), img_format=img_format)
    predictions = self.nima.nima_model.predict_generator(data_generator, workers=1, use_multiprocessing=False, verbose=1)
    for (i, sample) in enumerate(samples):
        sample['mean_score_prediction'] = calc_mean_score(predictions[i])
    if (predictions_file is not None):
        save_json(samples, predictions_file)
    return samples
def predict(self, image_source: str, predictions_file: Optional[str]=None, img_format: str='jpg') -> List:
    if os.path.isfile(image_source):
        (image_dir, samples) = image_file_to_json(image_source)
    else:
        image_dir = image_source
        samples = image_dir_to_json(image_source, img_type='jpg')
    n_classes = 10
    batch_size = 64
    samples = []
    sample = {'imgage_id': 'img_1'}
    samples.append(sample)
    data_generator = TestDataGenerator(samples, image_dir, batch_size, n_classes, self.nima.preprocessing_function(), img_format=img_format)
    predictions = self.nima.nima_model.predict_generator(data_generator, workers=1, use_multiprocessing=False, verbose=1)
    for (i, sample) in enumerate(samples):
        sample['mean_score_prediction'] = calc_mean_score(predictions[i])
    if (predictions_file is not None):
        save_json(samples, predictions_file)
    return samples