Complete the code to import the Flask library needed to create a REST API.
from flask import [1]
The Flask class is imported from the flask package to create the web app.
Complete the code to load a saved TensorFlow model from the 'model' folder.
model = tf.keras.models.[1]('model')
Use load_model to load a saved TensorFlow model from disk.
Fix the error in the prediction endpoint to correctly parse JSON input and make a prediction.
data = request.[1].get('input') prediction = model.predict([data])
Use request.json to access JSON data sent in the POST request.
Fill both blanks to create a Flask route that accepts POST requests at '/predict'.
@app.route('/predict', methods=[[1]]) def predict(): pass
The route must accept POST requests to receive data for prediction.
Fill all three blanks to return the prediction result as JSON with key 'result'.
from flask import jsonify @app.route('/predict', methods=['POST']) def predict(): data = request.json.get('input') prediction = model.predict([data]) return [1]([2]=[3])
Use jsonify to return JSON with key 'result' and value prediction.
