'Tensorflow.js loadLayersModel and model prediction, doesn't show the output

I'm very new to Tensorflow.js. In Python I've trained a model to classify whether person has or has not pneumonia. I've also created a website, so doctors could upload an Xray image and get an answer. I've fixed previous mistakes and don't have any now, but I noticed that it doesn't show anything.

I tried to do model.predict(img) and alert prediction. Then I decided to display some string, but it looks like it can't even reach that part of code?.. Because if I put alert earlier in function, everything works fine.

Could you please direct me?

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js">
        async function LoadModels(){
            model = undefined;
            model = await tf.loadLayersModel("D:/user/diploma/models/models/model.json");
            const prediction = model.predict("D:/user/diploma/IM-0115-0001.jpeg");
            alert("hi");  # my attempt to display anything
        }
        LoadModels();
</script>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source