def create_s3_filename()

in iot-blog/image-classification-connector-and-feedback/part_2/beverageclassifier.py [0:0]


def create_s3_filename(image_filename, predicted_category, prediction_confidence):
        # Add the predicted category and prediction confidence to the
        # file name for saving in S3. Format:
        # [image_filename (timestamp)]_[category]_[confidence (decimal)].jpg
        filename_no_ext = os.path.splitext(image_filename)[0]
        s3_file_name = "{}_{}_{}{}".format(filename_no_ext, predicted_category, str(round(prediction_confidence, 4)), os.path.splitext(image_filename)[1])
        return s3_file_name