Explore Library
Code QuizAdvanced

A Prediction REST Endpoint

Spot why POSTing JSON to this Flask endpoint fails to route.

Codepython
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route("/predict", methods=["GET"])
def predict():
    data = request.get_json()
    pred = model.predict([data["features"]])
    return jsonify({"prediction": pred.tolist()})

What is the bug in this serving endpoint?