I'm currently trying to build a system to send images to multiple remote servers in order to do some Open_CV and tesseract on pictures.
On one server it's okay because I rename my image into the folder before to send (first image sended is automatically named Image_0)
And then rename them again on reception, same order so the name is corresponding for the same image (Image_0 first sended and first received so named Image_0 in both local and remote) to make reading names easier when receiving results.
I receive then at the end of traitment a .txt file on local with the results of images (MRZ areas) like "Image_0 results XXXXXXXX<<<
My Problem --->
I want now to use multiple remote servers and use WORKQUEUE with rabbitMQ in order to do a basic workflow orchestration and reduce process time for my images samples.
How can I send the name of an image with that image in base64 to have corresponding names at the end in my .txt result file because my current method won(t work with multiple remote servers ?
Thanks for your help !
Here is how I send my images currently:
for file in natsorted(os.listdir()):
end_name=file[-4]+ file[-3]+ file[-2]+ file[-1]
if (end_name != ".txt"):
try:
with open(file, "rb") as image:
message = base64.b64encode(image.read())
channel.basic_publish(exchange='topic_logs',
routing_key=routing_key, body=message)
print(f"{file} || sended on topic %r \n" % (routing_key))
except IndexError:
print("No image given ! ")
sys.exit(1)
os.rename(file,"Image_"+str(ComptNames)+".png")
ComptNames=ComptNames+1