Complete the code to import the Flask class from the flask package.
from flask import [1] app = [1](__name__)
The Flask class is imported from the flask package to create the app instance.
Complete the code to define a route for the API endpoint '/predict'.
@app.route('[1]', methods=['POST']) def predict(): pass
The route decorator defines the URL path '/predict' for the prediction API.
Fix the error in the code to get JSON data from the POST request.
data = request.[1]Use request.get_json() method to parse JSON data from the request body.
Fill both blanks to load a saved model and make a prediction.
import joblib model = joblib.[1]('model.pkl') prediction = model.[2]([input_data])
Use joblib.load to load the saved model and model.predict to get predictions.
Fill both blanks to return the prediction as JSON with status code 200.
from flask import jsonify return jsonify([1]: prediction[0]}), [2]
Return JSON with key 'result' and HTTP status code 200 for success.
