Unable to display all the images in anvil form

from your code example I meant something more like this:

@anvil.server.callable
def task1(path):  
  
    ret = []    # empty array for storing images
    
    for i in os.listdir(path):
        img = tf.keras.preprocessing.image.load_img(path+'\\' +i, target_size=(200,200))        
        bs = io.BytesIO()
        ret.append({'image' : anvil.BlobMedia('image/jpeg', bs)})
        
    return ret