def main()

in run.py [0:0]


def main(argv):
    
    s3_bucket_name = argv[1] # s3 bucket name

    image_list = glob.glob("images/*")
    #random.shuffle(image_list)
    
    l4v = LookoutForVision(project_name="lookout-for-vision-workshop")
    
   
    for image_path in image_list:
        
        prediction = l4v.predict(local_file=image_path)
        print(prediction)
        
        filename = os.path.basename(image_path)
        product_id = int((re.findall(r'\d+', filename))[1])
        
        is_anomaly = 0
        if prediction['IsAnomalous'] == True:
            is_anomaly = 1
            
        confidence = prediction['Confidence']
        
        reinspection_needed = 0
        if confidence <= confidence_threshold:
            reinspection_needed = 1
        
        save_result(s3_bucket_name, product_id, is_anomaly, reinspection_needed)
        sleep(1)