Can a image be render on planes through scripting? Setup: Blender 2.82

I have multiple images that i take from a CNN and i want to put on planes

I tried like this:

mat = bpy.data.materials.new(name='test')
mat.use_nodes = True
bsdf = mat.node_tree.nodes["Principled BSDF"]
texImage = mat.node_tree.nodes.new('ShaderNodeTexImage')
texImage.image = bpy.data.images.load(image)
mat.node_tree.links.new(bsdf.inputs['Base Color'], texImage.outputs['Color'])

bpy.ops.mesh.primitive_plane_add(location=(k, y,  l ))
bpy.context.active_object.name = 'plane'
plane = bpy.context.object

if plane.data.materials:
     plane.data.materials[0] = mat
else:
     plane.data.materials.append(mat)


How can the image be loaded from an numpy array of pixels ? 

Additionally to this, does the image added to the plane needs to respect some format?
The only solution is to save the image that you want to put it on the plane and to load the image from there

texImage.image = bpy.data.images.load("path to your image saved previously in code")