I have a Python script which takes 2 images (of a person's face) and returns True/False based on the similarity of the two faces recognised in these pictures (kind of similar to the iPhone's Face ID). How would I have to incorporate this script in Java so that the 2 images are the input (received as 2 bytes arrays) and the output is the True/False statement? This script will be used in a web application, so it must be standalone.
I have tried running the script as an executable, but I am not really sure how am I supposed to give it the inputs (the bytes arrays).
This is the Python script I want to use in Java:
from PIL import Image
import numpy as np
from matplotlib import pyplot as plt
import face_recognition
image1 = face_recognition.load_image_file("../test_images/image1.jpg")
image2 = face_recognition.load_image_file("../test_images/image2.jpg")
encoding_1 = face_recognition.face_encodings(image1)[0]
encoding_2 = face_recognition.face_encodings(image2)[0]
results = face_recognition.compare_faces([encoding_1], encoding_2,tolerance=0.50)
print (results)