Face detection rest api

I’ve returned to a WordPress project that used the javascript code for Face Detection which has been deprecisted, so I’m looking for an alternative, which I think is a REST api, but I cannout find an example. Has anyone implemented Face Detection in wordpress?

I’d rather do it on the frontend than in PHP as i’ve got a complex ACF Repeater to update.

I’ve tried the following code

const PAT = 'mypat';
// Specify the correct user_id/app_id pairings
// Since you're making inferences outside your app's scope
const USER_ID = 'myuser';
const APP_ID = 'myapp';
// Change these to whatever model and image URL you want to use
const MODEL_ID = 'face-detection';
const MODEL_VERSION_ID = '6dc7e46bc9124c5c8824be4822abe105';
// old const MODEL_VERSION_ID = "45fb9a671625463fa646c3523a3087d5";
// Change this to whatever image URL you want to process

const IMAGE_URL = document.querySelectorAll(".show-if-value img")[0].src;concept
const CONCEPT_ID = 'ai_fvlBqXZR';

///////////////////////////////////////////////////////////////////////////////////
// YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE TO RUN THIS EXAMPLE
///////////////////////////////////////////////////////////////////////////////////

const raw = JSON.stringify({
    "user_app_id": {
        "user_id": USER_ID,
        "app_id": APP_ID
    },
    "searches": [
        {
            "query": {
                "ranks": [
                    {
                        "annotation": {
                            "data": {
                                "concepts": [
                                    {
                                        "id": CONCEPT_ID,
                                        "value": 1
                                    }
                                ]
                            }
                        }
                    }
                ]
            }
        }
    ]
});

const requestOptions = {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Authorization': 'Key ' + PAT
    },
    body: raw
};

fetch(`https://api.clarifai.com/v2/annnotations/searches`, requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

</script>

but I get an error “Uncaught SyntaxError: Unexpected token ‘export’ (at face-api:7:1326838)”