Im trying to create website with Flask and Tensorflow

Im Trying to create new website with tensorflow and Flask. I’m created model about eye diseases. I’m trying to get image with html. After that, predict that image with my model and see results on website.
Here is my Python Code (Im Turkish thats why some texts are Turkish.):

from flask import Flask, request, jsonify
from PIL import Image
import numpy as np
import base64
import io
import os
import tensorflow as tf
from tensorflow.python.keras.layers import Dense
from tensorflow.python.keras.models import load_model

os.environ['CUDA_VISIBLE_DEVICES'] = '0'

model = tf.keras.models.load_model("goz.model")

app = Flask(__name__)

@app.route('/predict', methods=["POST"])
def predict():
    response = request.get_json()
    data_str = response['image']
    point = data_str.find(',')
    base64_str = data_str[point:]

    image = base64.b64decode(base64_str)       
    img = Image.open(io.BytesIO(image))

    if(img.mode!='RGB'):
        img = img.convert("RGB")
    
    CATEGORIES = ["Cataract", "Diabetic_retinopathy", "gluacoma", "normal" ]
    img = img.resize((180, 180))

    x = img.img_to_array(img)
    x = np.expand_dims(x, 0)
  
    preds = model.predict(img, model)
    score = tf.nn.softmax(preds[0])
    result = "Bu fotograf su hastaliga benziyor: {} yuz uzerinden su kadar eminim: {:.2f}.".format(CATEGORIES[np.argmax(score)], 100*np.max(score))

    return jsonify(result)

@app.after_request
def add_headers(response):
    response.headers.add('Access-Control-Allow-Origin', '*')
    response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')


    return response


if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')

But when i submit image this is happening:

Error

Here mentioned codes in Error (writed with HTML and Javascript):
Line 172-190:

function predictImage(image) {
  fetch("/predict", {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify(image)
  })
    .then(resp => {
      if (resp.ok)
        resp.json().then(data => {
          displayResult(data);
        });
    })
    .catch(err => {
      console.log("An error occured", err.message);
      window.alert("Oops! Something went wrong.");
    });
}

Line 123-140:


function submitImage() {
 console.log("submit");

  if (!imageDisplay.src || !imageDisplay.src.startsWith("data")) {
    window.alert("Please select an image before submit.");
    return;
  }

  loader?.classList?.remove("hidden");
  imageDisplay.classList.add("loading");

  predictImage(imageDisplay.src);
}

Line 53:

          <input type="button" value="Submit" class="button" onclick="submitImage();" />